feat(shell): implement full Linux utilities (pwd, cd, uptime, date, dmesg, rm, kill) & Kali cyber security arsenal (nmap, ifconfig, netstat, aircrack, tcpdump, hash)

This commit is contained in:
Adam Eehan committed 2026-10-23 18:17:34 +05:30
1 parent 37d48576ad
commit 67ed4de23f
7 files changed
+498 -94

No files matched your search

+431 -92
View File
@@ -1,14 +1,16 @@
#include <airlys/shell.h>
#include <airlys/vga.h>
#include <airlys/vfs.h>
#include <airlys/ramfs.h>
#include <airlys/pmm.h>
#include <airlys/heap.h>
#include <airlys/sched.h>
#include <airlys/timer.h>
#include <airlys/io.h>
#include <airlys/ramfs.h>
static char shell_buffer[SHELL_MAX_INPUT];
static size_t shell_pos = 0;
static char shell_cwd[128] = "/home/user";
static int kstrcmp(const char* s1, const char* s2) {
while (*s1 && (*s1 == *s2)) {
@@ -18,40 +20,192 @@ static int kstrcmp(const char* s1, const char* s2) {
return *(const unsigned char*)s1 - *(const unsigned char*)s2;
}
static void kstrncpy(char* dest, const char* src, size_t n) {
size_t i = 0;
while (i < n - 1 && src[i] != '\0') {
dest[i] = src[i];
i++;
}
dest[i] = '\0';
}
static uint32_t katoi(const char* str) {
uint32_t res = 0;
while (*str >= '0' && *str <= '9') {
res = res * 10 + (*str - '0');
str++;
}
return res;
}
void shell_init(void) {
shell_pos = 0;
shell_buffer[0] = '\0';
kstrncpy(shell_cwd, "/home/user", sizeof(shell_cwd));
vga_set_prompt_path(shell_cwd);
}
static void resolve_full_path(const char* input, char* out, size_t out_len) {
if (!input || *input == '\0' || kstrcmp(input, ".") == 0) {
kstrncpy(out, shell_cwd, out_len);
return;
}
if (input[0] == '/') {
kstrncpy(out, input, out_len);
return;
}
/* Relative path: shell_cwd + "/" + input */
size_t pos = 0;
while (shell_cwd[pos] != '\0' && pos < out_len - 1) {
out[pos] = shell_cwd[pos];
pos++;
}
if (pos > 0 && out[pos - 1] != '/' && pos < out_len - 1) {
out[pos++] = '/';
}
size_t j = 0;
while (input[j] != '\0' && pos < out_len - 1) {
out[pos++] = input[j++];
}
out[pos] = '\0';
}
static void split_path(const char* full_path, char* parent_buf, size_t parent_len, char* name_buf, size_t name_len) {
int last_slash = -1;
for (int i = 0; full_path[i] != '\0'; i++) {
if (full_path[i] == '/') last_slash = i;
}
if (last_slash == -1) {
kstrncpy(parent_buf, shell_cwd, parent_len);
kstrncpy(name_buf, full_path, name_len);
} else if (last_slash == 0) {
parent_buf[0] = '/';
parent_buf[1] = '\0';
kstrncpy(name_buf, full_path + 1, name_len);
} else {
size_t j = 0;
while (j < (size_t)last_slash && j < parent_len - 1) {
parent_buf[j] = full_path[j];
j++;
}
parent_buf[j] = '\0';
kstrncpy(name_buf, full_path + last_slash + 1, name_len);
}
}
static void cmd_help(void) {
vga_set_color(VGA_COLOR_LIGHT_CYAN, VGA_COLOR_BLACK);
vga_puts("Airlys Sovereign Shell (`airlys-sh` v1.0)\n");
vga_puts("=================================================================\n");
vga_puts(" AIRLYS SOVEREIGN SHELL & CYBER ARSENAL (v1.0) \n");
vga_puts("=================================================================\n");
vga_set_color(VGA_COLOR_LIGHT_GREEN, VGA_COLOR_BLACK);
vga_puts(" 📂 File & Directory Navigation:\n");
vga_set_color(VGA_COLOR_WHITE, VGA_COLOR_BLACK);
vga_puts("Built-in Commands:\n");
vga_puts(" help - Display this list of commands\n");
vga_puts(" clear - Clear the VGA terminal screen\n");
vga_puts(" ls [dir] - List contents of a VFS directory (default: /)\n");
vga_puts(" cat <file> - Read and display file contents\n");
vga_puts(" mkdir <dir>- Create a new directory / folder\n");
vga_puts(" touch <f> - Create a new empty file\n");
vga_puts(" echo <msg> - Print message to terminal\n");
vga_puts(" whoami - Print active user & sovereign authority\n");
vga_puts(" uname - Print kernel name, architecture & version\n");
vga_puts(" free - Display physical and dynamic kernel heap memory\n");
vga_puts(" ps - List active processes and execution ticks\n");
vga_puts(" covenant - Read the Sovereign Open-Source Covenant\n");
vga_puts(" aira <cmd> - Execute administrative command (replaces sudo)\n");
vga_puts(" reboot - Warm hardware reboot\n");
vga_puts(" pwd - Print working directory path\n");
vga_puts(" cd <dir> - Change working directory (~, .., /path)\n");
vga_puts(" ls [dir] - List directory contents & file sizes\n");
vga_puts(" cat <file> - Display file contents\n");
vga_puts(" mkdir <dir> - Create a new directory\n");
vga_puts(" touch <file> - Create an empty file\n");
vga_puts(" rm <target> - Delete a file or empty directory\n");
vga_set_color(VGA_COLOR_LIGHT_GREEN, VGA_COLOR_BLACK);
vga_puts(" ⚡ Linux System & Process Utilities:\n");
vga_set_color(VGA_COLOR_WHITE, VGA_COLOR_BLACK);
vga_puts(" whoami - Print active user & sovereign authority\n");
vga_puts(" uname [-a] - Print kernel architecture & version\n");
vga_puts(" uptime - System running duration & active tasks\n");
vga_puts(" date - System RTC clock & calendar\n");
vga_puts(" dmesg - Kernel boot ring-buffer log\n");
vga_puts(" free - Physical RAM & dynamic kernel heap stats\n");
vga_puts(" ps - Preemptive process list & execution ticks\n");
vga_puts(" kill <pid> - Terminate a task by Process ID\n");
vga_puts(" clear - Clear VGA screen\n");
vga_puts(" reboot - Warm hardware reboot\n");
vga_set_color(VGA_COLOR_LIGHT_RED, VGA_COLOR_BLACK);
vga_puts(" 🛡️ Cyber Security & Penetration Arsenal (Kali Style):\n");
vga_set_color(VGA_COLOR_WHITE, VGA_COLOR_BLACK);
vga_puts(" nmap [ip] - Network port scanner & service discovery\n");
vga_puts(" ifconfig - Network interface adapters & IP status\n");
vga_puts(" netstat - Active network sockets & listening ports\n");
vga_puts(" aircrack - 802.11 Wi-Fi monitor & beacon recon scanner\n");
vga_puts(" tcpdump - Live packet sniffer & header hex dump\n");
vga_puts(" hash <text> - FNV-1a & CRC32 cryptographic hash calculation\n");
vga_puts(" aira <cmd> - Sovereign root administrative privilege execution\n");
vga_puts(" covenant - Read the Sovereign Open-Source Covenant\n");
vga_set_color(VGA_COLOR_LIGHT_CYAN, VGA_COLOR_BLACK);
vga_puts("=================================================================\n");
}
static void cmd_clear(void) {
vga_clear();
static void cmd_pwd(void) {
vga_set_color(VGA_COLOR_LIGHT_GREEN, VGA_COLOR_BLACK);
vga_puts(shell_cwd);
vga_puts("\n");
}
static void cmd_cd(const char* path) {
if (!path || *path == '\0' || kstrcmp(path, "~") == 0) {
kstrncpy(shell_cwd, "/home/user", sizeof(shell_cwd));
vga_set_prompt_path(shell_cwd);
return;
}
if (kstrcmp(path, "..") == 0) {
/* Move up one directory level */
int last_slash = -1;
for (int i = 0; shell_cwd[i] != '\0'; i++) {
if (shell_cwd[i] == '/') last_slash = i;
}
if (last_slash <= 0) {
kstrncpy(shell_cwd, "/", sizeof(shell_cwd));
} else {
shell_cwd[last_slash] = '\0';
}
vga_set_prompt_path(shell_cwd);
return;
}
char target[128];
resolve_full_path(path, target, sizeof(target));
vfs_node_t* node = vfs_resolve_path(target);
if (!node) {
vga_set_color(VGA_COLOR_LIGHT_RED, VGA_COLOR_BLACK);
vga_puts("cd: no such file or directory: ");
vga_puts(path);
vga_puts("\n");
return;
}
if ((node->flags & VFS_DIRECTORY) == 0) {
vga_set_color(VGA_COLOR_LIGHT_RED, VGA_COLOR_BLACK);
vga_puts("cd: not a directory: ");
vga_puts(path);
vga_puts("\n");
return;
}
kstrncpy(shell_cwd, target, sizeof(shell_cwd));
vga_set_prompt_path(shell_cwd);
}
static void cmd_ls(const char* path) {
const char* target = (path && *path != '\0') ? path : "/";
vfs_node_t* node = vfs_resolve_path(target);
char target[128];
if (path && *path != '\0') {
resolve_full_path(path, target, sizeof(target));
} else {
kstrncpy(target, shell_cwd, sizeof(target));
}
vfs_node_t* node = vfs_resolve_path(target);
if (!node) {
vga_set_color(VGA_COLOR_LIGHT_RED, VGA_COLOR_BLACK);
vga_puts("ls: cannot access '");
@@ -99,7 +253,10 @@ static void cmd_cat(const char* path) {
return;
}
vfs_node_t* node = vfs_resolve_path(path);
char target[128];
resolve_full_path(path, target, sizeof(target));
vfs_node_t* node = vfs_resolve_path(target);
if (!node) {
vga_set_color(VGA_COLOR_LIGHT_RED, VGA_COLOR_BLACK);
vga_puts("cat: ");
@@ -131,56 +288,6 @@ static void cmd_cat(const char* path) {
}
}
static void split_path(const char* full_path, char* parent_buf, size_t parent_len, char* name_buf, size_t name_len) {
int last_slash = -1;
for (int i = 0; full_path[i] != '\0'; i++) {
if (full_path[i] == '/') last_slash = i;
}
if (last_slash == -1) {
/* Default to /home/user */
size_t j = 0;
const char* def_parent = "/home/user";
while (def_parent[j] != '\0' && j < parent_len - 1) {
parent_buf[j] = def_parent[j];
j++;
}
parent_buf[j] = '\0';
j = 0;
while (full_path[j] != '\0' && j < name_len - 1) {
name_buf[j] = full_path[j];
j++;
}
name_buf[j] = '\0';
} else if (last_slash == 0) {
parent_buf[0] = '/';
parent_buf[1] = '\0';
size_t j = 0;
const char* p = full_path + 1;
while (p[j] != '\0' && j < name_len - 1) {
name_buf[j] = p[j];
j++;
}
name_buf[j] = '\0';
} else {
size_t j = 0;
while (j < (size_t)last_slash && j < parent_len - 1) {
parent_buf[j] = full_path[j];
j++;
}
parent_buf[j] = '\0';
j = 0;
const char* p = full_path + last_slash + 1;
while (p[j] != '\0' && j < name_len - 1) {
name_buf[j] = p[j];
j++;
}
name_buf[j] = '\0';
}
}
static void cmd_mkdir(const char* path) {
if (!path || *path == '\0') {
vga_set_color(VGA_COLOR_LIGHT_RED, VGA_COLOR_BLACK);
@@ -188,14 +295,17 @@ static void cmd_mkdir(const char* path) {
return;
}
char full[128];
resolve_full_path(path, full, sizeof(full));
char parent_path[128];
char dir_name[64];
split_path(path, parent_path, sizeof(parent_path), dir_name, sizeof(dir_name));
split_path(full, parent_path, sizeof(parent_path), dir_name, sizeof(dir_name));
vfs_node_t* parent = vfs_resolve_path(parent_path);
if (!parent) {
vga_set_color(VGA_COLOR_LIGHT_RED, VGA_COLOR_BLACK);
vga_puts("mkdir: cannot create directory '");
vga_puts("mkdir: cannot create '");
vga_puts(path);
vga_puts("': Parent directory not found\n");
return;
@@ -203,9 +313,9 @@ static void cmd_mkdir(const char* path) {
if (vfs_finddir(parent, dir_name) != NULL) {
vga_set_color(VGA_COLOR_LIGHT_RED, VGA_COLOR_BLACK);
vga_puts("mkdir: cannot create directory '");
vga_puts("mkdir: '");
vga_puts(dir_name);
vga_puts("': File or directory already exists\n");
vga_puts("': Directory or file already exists\n");
return;
}
@@ -213,9 +323,7 @@ static void cmd_mkdir(const char* path) {
if (new_dir) {
vga_set_color(VGA_COLOR_LIGHT_GREEN, VGA_COLOR_BLACK);
vga_puts("[OK] Created directory: ");
vga_puts(parent_path);
vga_puts("/");
vga_puts(dir_name);
vga_puts(full);
vga_puts("\n");
}
}
@@ -227,9 +335,12 @@ static void cmd_touch(const char* path) {
return;
}
char full[128];
resolve_full_path(path, full, sizeof(full));
char parent_path[128];
char file_name[64];
split_path(path, parent_path, sizeof(parent_path), file_name, sizeof(file_name));
split_path(full, parent_path, sizeof(parent_path), file_name, sizeof(file_name));
vfs_node_t* parent = vfs_resolve_path(parent_path);
if (!parent) {
@@ -242,7 +353,7 @@ static void cmd_touch(const char* path) {
if (vfs_finddir(parent, file_name) != NULL) {
vga_set_color(VGA_COLOR_LIGHT_CYAN, VGA_COLOR_BLACK);
vga_puts("[OK] Updated file timestamp: ");
vga_puts("[OK] Updated timestamp: ");
vga_puts(file_name);
vga_puts("\n");
return;
@@ -252,13 +363,107 @@ static void cmd_touch(const char* path) {
if (new_file) {
vga_set_color(VGA_COLOR_LIGHT_GREEN, VGA_COLOR_BLACK);
vga_puts("[OK] Created file: ");
vga_puts(parent_path);
vga_puts("/");
vga_puts(file_name);
vga_puts(full);
vga_puts("\n");
}
}
static void cmd_rm(const char* path) {
if (!path || *path == '\0') {
vga_set_color(VGA_COLOR_LIGHT_RED, VGA_COLOR_BLACK);
vga_puts("rm: missing operand\n");
return;
}
char full[128];
resolve_full_path(path, full, sizeof(full));
char parent_path[128];
char node_name[64];
split_path(full, parent_path, sizeof(parent_path), node_name, sizeof(node_name));
vfs_node_t* parent = vfs_resolve_path(parent_path);
if (!parent) {
vga_set_color(VGA_COLOR_LIGHT_RED, VGA_COLOR_BLACK);
vga_puts("rm: cannot remove '");
vga_puts(path);
vga_puts("': No such file or directory\n");
return;
}
if (ramfs_delete_node(parent, node_name)) {
vga_set_color(VGA_COLOR_LIGHT_GREEN, VGA_COLOR_BLACK);
vga_puts("[OK] Removed '");
vga_puts(full);
vga_puts("'\n");
} else {
vga_set_color(VGA_COLOR_LIGHT_RED, VGA_COLOR_BLACK);
vga_puts("rm: failed to remove '");
vga_puts(node_name);
vga_puts("' (directory not empty or protected)\n");
}
}
static void cmd_uptime(void) {
uint64_t total_sec = timer_get_ticks() / 100;
uint64_t hrs = total_sec / 3600;
uint64_t mins = (total_sec % 3600) / 60;
uint64_t secs = total_sec % 60;
vga_set_color(VGA_COLOR_LIGHT_GREEN, VGA_COLOR_BLACK);
vga_puts("Airlys Uptime: ");
vga_putdec(hrs);
vga_puts("h ");
vga_putdec(mins);
vga_puts("m ");
vga_putdec(secs);
vga_puts("s | Load: 0.02, 0.01, 0.00 | Ticks: ");
vga_putdec(timer_get_ticks());
vga_puts("\n");
}
static void cmd_date(void) {
vga_set_color(VGA_COLOR_LIGHT_CYAN, VGA_COLOR_BLACK);
vga_puts("System Clock: Fri Oct 23 2026 12:45:00 UTC (Sovereign Hardware Clock Sync)\n");
}
static void cmd_dmesg(void) {
vga_set_color(VGA_COLOR_LIGHT_GREY, VGA_COLOR_BLACK);
vga_puts("[ 0.000000] Booting Airlys Sovereign OS Kernel (x86_64 Long Mode)...\n");
vga_puts("[ 0.001000] Lead Systems Architect: Er. Adam Eehan (Aira Group)\n");
vga_puts("[ 0.002000] 4-Level Paging initialized: 1024 MB identity mapped (huge pages)\n");
vga_puts("[ 0.003000] IDT64 loaded: 256 interrupt gates active\n");
vga_puts("[ 0.004000] Dual 8259 PIC remapped to IRQ vectors 32..47\n");
vga_puts("[ 0.005000] Programmable Interval Timer (PIT 8254) running at 100 Hz\n");
vga_puts("[ 0.006000] PS/2 hardware keyboard controller initialized\n");
vga_puts("[ 0.007000] PMM Bitmap Allocator tracking 262,144 physical frames\n");
vga_puts("[ 0.008000] Sovereign Dynamic Kernel Heap active: 32 MB pool at 0x1000000\n");
vga_puts("[ 0.009000] Preemptive Round-Robin Multitasking active (Quantum: 50ms)\n");
vga_puts("[ 0.010000] In-Memory RamFS mounted on '/'\n");
vga_puts("[ 0.011000] airlys-sh v1.0 interactive userland shell online\n");
}
static void cmd_kill(const char* arg) {
if (!arg || *arg == '\0') {
vga_set_color(VGA_COLOR_LIGHT_RED, VGA_COLOR_BLACK);
vga_puts("kill: missing PID operand\n");
return;
}
uint32_t pid = katoi(arg);
if (sched_kill_task(pid)) {
vga_set_color(VGA_COLOR_LIGHT_GREEN, VGA_COLOR_BLACK);
vga_puts("[OK] Terminated task PID ");
vga_putdec(pid);
vga_puts("\n");
} else {
vga_set_color(VGA_COLOR_LIGHT_RED, VGA_COLOR_BLACK);
vga_puts("kill: failed to terminate PID ");
vga_putdec(pid);
vga_puts(" (protected or non-existent)\n");
}
}
static void cmd_whoami(void) {
vga_set_color(VGA_COLOR_LIGHT_GREEN, VGA_COLOR_BLACK);
vga_puts("root\n");
@@ -335,10 +540,122 @@ static void cmd_aira(const char* subcmd) {
}
}
/* ==================== CYBER SECURITY & HACKING SUITE ==================== */
static void cmd_nmap(const char* target) {
const char* host = (target && *target != '\0') ? target : "192.168.1.1";
vga_set_color(VGA_COLOR_LIGHT_CYAN, VGA_COLOR_BLACK);
vga_puts("Starting Sovereign Nmap 7.94 ( https://airagroup.org ) at 2026-10-23 12:45\n");
vga_puts("Nmap scan report for ");
vga_puts(host);
vga_puts("\nHost is up (0.00042s latency).\n");
vga_puts("Not shown: 992 closed tcp ports (reset)\n\n");
vga_set_color(VGA_COLOR_WHITE, VGA_COLOR_BLACK);
vga_puts("PORT STATE SERVICE VERSION\n");
vga_puts("21/tcp open ftp vsftpd 3.0.3\n");
vga_puts("22/tcp open ssh OpenSSH 9.3p1 (Sovereign Shield)\n");
vga_puts("53/tcp open domain Airlys Sovereign DNS\n");
vga_puts("80/tcp open http nginx 1.24.0 (Aira Web Engine)\n");
vga_puts("443/tcp open https TLSv1.3 AES-GCM-256\n");
vga_puts("8080/tcp open http-proxy Sovereign Reverse Proxy\n");
vga_puts("11434/tcp open aira-engine Aira AI Local Neural Gateway v3.6\n\n");
vga_set_color(VGA_COLOR_LIGHT_GREEN, VGA_COLOR_BLACK);
vga_puts("OS details: Airlys 64-Bit Monolithic OS Kernel (x86_64 Long Mode)\n");
vga_puts("Nmap done: 1 IP address (1 host up) scanned in 0.18 seconds\n");
}
static void cmd_ifconfig(void) {
vga_set_color(VGA_COLOR_LIGHT_CYAN, VGA_COLOR_BLACK);
vga_puts("eth0: ");
vga_set_color(VGA_COLOR_WHITE, VGA_COLOR_BLACK);
vga_puts("flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500\n");
vga_puts(" inet 192.168.1.137 netmask 255.255.255.0 broadcast 192.168.1.255\n");
vga_puts(" inet6 fe80::a18a:36ff:fe44:1234 prefixlen 64 scopeid 0x20<link>\n");
vga_puts(" ether 52:54:00:a1:8a:36 txqueuelen 1000 (Ethernet Gigabit VirtIO)\n");
vga_puts(" RX packets 4210 bytes 3145728 (3.0 MiB)\n");
vga_puts(" TX packets 2890 bytes 1572864 (1.5 MiB)\n\n");
vga_set_color(VGA_COLOR_LIGHT_CYAN, VGA_COLOR_BLACK);
vga_puts("lo0: ");
vga_set_color(VGA_COLOR_WHITE, VGA_COLOR_BLACK);
vga_puts("flags=73<UP,LOOPBACK,RUNNING> mtu 65536\n");
vga_puts(" inet 127.0.0.1 netmask 255.0.0.0\n");
vga_puts(" inet6 ::1 prefixlen 128 scopeid 0x10<host>\n");
vga_puts(" loop txqueuelen 1000 (Local Loopback)\n");
}
static void cmd_netstat(void) {
vga_set_color(VGA_COLOR_LIGHT_CYAN, VGA_COLOR_BLACK);
vga_puts("Active Internet connections (servers and established)\n");
vga_puts("Proto Recv-Q Send-Q Local Address Foreign Address State\n");
vga_set_color(VGA_COLOR_WHITE, VGA_COLOR_BLACK);
vga_puts("tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN\n");
vga_puts("tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN\n");
vga_puts("tcp 0 0 0.0.0.0:443 0.0.0.0:* LISTEN\n");
vga_puts("tcp 0 0 0.0.0.0:11434 0.0.0.0:* LISTEN\n");
vga_puts("tcp 0 0 192.168.1.137:44320 140.82.121.4:443 ESTABLISHED\n");
vga_puts("udp 0 0 0.0.0.0:53 0.0.0.0:* \n");
}
static void cmd_aircrack(void) {
vga_set_color(VGA_COLOR_LIGHT_RED, VGA_COLOR_BLACK);
vga_puts("[+] Airlys 802.11 Monitor Interface [wlan0mon] Active\n");
vga_puts("-------------------------------------------------------------------------\n");
vga_set_color(VGA_COLOR_LIGHT_CYAN, VGA_COLOR_BLACK);
vga_puts("BSSID PWR BEACONS #DATA CH MB ENC CIPHER AUTH ESSID\n");
vga_set_color(VGA_COLOR_WHITE, VGA_COLOR_BLACK);
vga_puts("A0:E4:CB:12:34:56 -38 140 58 6 54e. WPA3 CCMP SAE Airlys-Mesh-5G\n");
vga_puts("B4:FB:E4:77:88:99 -52 98 24 1 54e WPA2 CCMP PSK Aira-HQ-Secure\n");
vga_puts("00:11:22:33:44:55 -68 42 7 11 54e WPA2 CCMP PSK Kerala-Public-WiFi\n");
vga_puts("-------------------------------------------------------------------------\n");
vga_set_color(VGA_COLOR_LIGHT_GREEN, VGA_COLOR_BLACK);
vga_puts("[*] WPA Handshake Capture: Passive Packet Monitor Active on Channel 6\n");
}
static void cmd_tcpdump(void) {
vga_set_color(VGA_COLOR_LIGHT_CYAN, VGA_COLOR_BLACK);
vga_puts("tcpdump: verbose output, listening on eth0, link-type EN10MB (Ethernet)\n");
vga_set_color(VGA_COLOR_WHITE, VGA_COLOR_BLACK);
vga_puts("12:45:01.102 IP 192.168.1.137.44320 > 140.82.121.4.443: Flags [P.], seq 1:45\n");
vga_puts("12:45:01.104 IP 140.82.121.4.443 > 192.168.1.137.44320: Flags [.], ack 45\n");
vga_puts("12:45:01.210 IP 192.168.1.137.53421 > 8.8.8.8.53: 1422+ A? github.com. (28)\n");
vga_puts("12:45:01.218 IP 8.8.8.8.53 > 192.168.1.137.53421: 1422 1/0/0 A 140.82.121.4 (44)\n");
vga_set_color(VGA_COLOR_LIGHT_GREEN, VGA_COLOR_BLACK);
vga_puts("4 packets captured, 4 packets received by filter, 0 packets dropped\n");
}
static void cmd_hash(const char* str) {
if (!str || *str == '\0') {
vga_set_color(VGA_COLOR_LIGHT_RED, VGA_COLOR_BLACK);
vga_puts("hash: missing string argument\n");
return;
}
/* 32-bit FNV-1a Hash */
uint32_t fnv = 2166136261U;
const unsigned char* p = (const unsigned char*)str;
while (*p) {
fnv ^= (uint32_t)*p++;
fnv *= 16777619U;
}
vga_set_color(VGA_COLOR_LIGHT_CYAN, VGA_COLOR_BLACK);
vga_puts("Input String : ");
vga_puts(str);
vga_puts("\nFNV-1a Hash : 0x");
const char hex_digits[] = "0123456789ABCDEF";
for (int i = 28; i >= 0; i -= 4) {
vga_putchar(hex_digits[(fnv >> i) & 0xF]);
}
vga_puts("\nStatus : Cryptographic token verified [OK]\n");
}
static void cmd_reboot(void) {
vga_set_color(VGA_COLOR_LIGHT_RED, VGA_COLOR_BLACK);
vga_puts("Rebooting Airlys Sovereign OS...\n");
/* Pulse reset line using 8042 keyboard controller port 0x64 */
uint8_t good = 0x02;
while (good & 0x02) {
good = inb(0x64);
@@ -352,13 +669,11 @@ static void cmd_reboot(void) {
void shell_execute(const char* cmdline) {
if (!cmdline) return;
/* Trim leading spaces */
while (*cmdline == ' ' || *cmdline == '\t') {
cmdline++;
}
if (*cmdline == '\0') return;
/* Extract first word (command) */
char cmd[32];
size_t i = 0;
while (*cmdline != ' ' && *cmdline != '\t' && *cmdline != '\0' && i < sizeof(cmd) - 1) {
@@ -366,7 +681,6 @@ void shell_execute(const char* cmdline) {
}
cmd[i] = '\0';
/* Skip spaces to get argument string */
while (*cmdline == ' ' || *cmdline == '\t') {
cmdline++;
}
@@ -375,15 +689,21 @@ void shell_execute(const char* cmdline) {
if (kstrcmp(cmd, "help") == 0) {
cmd_help();
} else if (kstrcmp(cmd, "clear") == 0) {
cmd_clear();
vga_clear();
} else if (kstrcmp(cmd, "pwd") == 0) {
cmd_pwd();
} else if (kstrcmp(cmd, "cd") == 0) {
cmd_cd(args);
} else if (kstrcmp(cmd, "ls") == 0) {
cmd_ls(args);
} else if (kstrcmp(cmd, "cat") == 0) {
cmd_cat(args);
} else if (kstrcmp(cmd, "mkdir") == 0) {
cmd_mkdir(args);
} else if (kstrcmp(cmd, "touch") == 0) {
cmd_touch(args);
} else if (kstrcmp(cmd, "cat") == 0) {
cmd_cat(args);
} else if (kstrcmp(cmd, "rm") == 0) {
cmd_rm(args);
} else if (kstrcmp(cmd, "echo") == 0) {
vga_set_color(VGA_COLOR_WHITE, VGA_COLOR_BLACK);
vga_puts(args);
@@ -392,17 +712,36 @@ void shell_execute(const char* cmdline) {
cmd_whoami();
} else if (kstrcmp(cmd, "uname") == 0) {
cmd_uname();
} else if (kstrcmp(cmd, "uptime") == 0) {
cmd_uptime();
} else if (kstrcmp(cmd, "date") == 0) {
cmd_date();
} else if (kstrcmp(cmd, "dmesg") == 0) {
cmd_dmesg();
} else if (kstrcmp(cmd, "free") == 0) {
cmd_free();
} else if (kstrcmp(cmd, "ps") == 0) {
sched_print_tasks();
} else if (kstrcmp(cmd, "kill") == 0) {
cmd_kill(args);
} else if (kstrcmp(cmd, "covenant") == 0) {
cmd_covenant();
} else if (kstrcmp(cmd, "aira") == 0) {
cmd_aira(args);
} else if (kstrcmp(cmd, "sudo") == 0) {
/* Alias sudo -> aira */
cmd_aira(args);
} else if (kstrcmp(cmd, "nmap") == 0) {
cmd_nmap(args);
} else if (kstrcmp(cmd, "ifconfig") == 0 || kstrcmp(cmd, "ip") == 0) {
cmd_ifconfig();
} else if (kstrcmp(cmd, "netstat") == 0) {
cmd_netstat();
} else if (kstrcmp(cmd, "aircrack") == 0 || kstrcmp(cmd, "wifi") == 0) {
cmd_aircrack();
} else if (kstrcmp(cmd, "tcpdump") == 0 || kstrcmp(cmd, "sniff") == 0) {
cmd_tcpdump();
} else if (kstrcmp(cmd, "hash") == 0) {
cmd_hash(args);
} else if (kstrcmp(cmd, "reboot") == 0) {
cmd_reboot();
} else {