Skip to content

Commit

Permalink
Merge hotfix for tinybox imports
Browse files Browse the repository at this point in the history
  • Loading branch information
cosmic-zip committed Jul 28, 2024
1 parent 6f479be commit 1b2de93
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 49 deletions.
36 changes: 16 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ PanzerMaid is a CLI automation engine with infinite support for extensions throu

### Does it only execute shell scripts?

No. PanzerMaid is the CLI interface using tinybox. The tinybox is a simple Linux shell and includes unixutils.dart with functions like ls, tree, mkdir, and can emulate devices like /dev/random and /dev/zero.
No. PanzerMaid is the CLI interface using tinybox. The tinybox is a simple Linux shell and includes dos_utils.dart with functions like ls, tree, mkdir, and can emulate devices like /dev/random and /dev/zero.

In later versions, the unixutils will expand to become more like a busybox, suitable for use on both Unix-like systems and Android, utilizing a Flutter app to spawn the initial thread and execute external binaries like nmap or ffmpeg.
In later versions, the dos_utils will expand to become more like a busybox, suitable for use on both Unix-like systems and Android, utilizing a Flutter app to spawn the initial thread and execute external binaries like nmap or ffmpeg.

### What does the @w@ (UwU) parser do?

Expand All @@ -38,28 +38,24 @@ When calling it:

In the future, it will not require any external tools or advanced permissions because it uses 100% self-contained execs (scripts or binaries) to perform all tasks.

## UNIX AND MSDOS MODES
## Integrated app

That's a thing for future versions: the addition of MSDOS command aliases. It depends on the development of unixutils, but it will have these aliases just for fun.
![grid_app](wiki/files/bean.png)

Regarding running MSDOS itself, it's possible with a Flutter terminal app, but there's still a lot of work to be done.
| Project | Description |
| ------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **MaidZ** | Improved an deferent version of witch_craft and previous tools, uses bank.json to store all alias, commands, and single line shell scripts |
| **Witch_Craft** | Rust based framework, store all alias inside structs |
| **LinuxEvilToolkit** | Original toolkit from 2018, uses ruby and store all alias and scripts inside variables, the most complete version, deprecated due complexity |
| **MaidSecLists 2024 Rev2** | My own version of SecLists but using standard file names, merging word lists and remove garbage files, this rev2 refers to MaidZ version of MaidSecLists. |
| **The book Hacker Heuristics** | My collection of notes, scripts and articles, news, etc. |

**Rewrite every thing again, but why?**
## UNIX AND MSDOS MODES

Long story short: In 2019, I had to install Arch Linux on my laptop with LUKS. I decided to write a shell script to automate most of the installation, packages, configurations, etc. The script grew big, and I began to improve it. I ported it to Python, later to C (although I failed, I learned a bit of C), then to Ruby (failed again, but learned Ruby and something about Rails), and later to Rust. Rust was amazing, but I needed to work with Python. Keeping such a giant stack of technologies and programming languages was killing my performance in all of them.
Almost done!

Now, I have migrated my entire stack to Flutter and backend to serverless technologies like Lambda, Firebase, etc. The fact that Dart compiles also helps, as I can just build and install a small binary. I plan to implement everything in Dart and stop using third-party tools like dirb, nmap, whois, etc. This will allow me to create an extremely useful and rootless hacking app for iOS and Android.
## Project origins

![grid_app](wiki/files/bean.png)
Long story short: In 2019, I had to install Arch Linux on my laptop with LUKS. I decided to write a shell script to automate most of the installation, packages, configurations, etc. The script grew big, and I began to improve it. I ported it to Python, later to C (although I failed, I learned a bit of C), then to Ruby (failed again, but learned Ruby and something about Rails), and later to Rust. Rust was amazing, but I needed to work with Python. Keeping such a giant stack of technologies and programming languages was killing my performance in all of them.

| Project | Description |
| -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **MaidZ** | Improved an deferent version of witch_craft and previous tools, uses bank.json to store all alias, commands, and single line shell scripts |
| **Witch_Craft** | Rust based framework, store all alias inside structs |
| **LinuxEvilToolkit** | Original toolkit from 2018, uses ruby and store all alias and scripts inside variables, the most complete version, deprecated due complexity |
| **MaidSecLists 2024 Rev2** | My own version of SecLists but using standard file names, merging word lists and remove garbage files, this rev2 refers to MaidZ version of MaidSecLists. |

<p align="center">
<p>BSD 3-Clause License</p>
<p>Copyright (c) 2024, Cosmic</p>
</p>
Now, I have migrated my entire stack to Flutter and backend to serverless technologies like Lambda, Firebase, etc. The fact that Dart compiles also helps, as I can just build and install a small binary. I plan to implement everything in Dart and stop using third-party tools like dirb, nmap, whois, etc. This will allow me to create an extremely useful and rootless hacking app for iOS and Android.
10 changes: 4 additions & 6 deletions src/lib/maid_shell.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'package:panzer_maid/maid_shell/dos_utils.dart';
import 'package:panzer_maid/maid_shell/shell.dart';
import 'package:panzer_maid/maid_shell/tinybox.dart';
import 'package:panzer_maid/maid_shell/utils.dart';

class MaidShell {
Expand All @@ -15,14 +15,12 @@ class MaidShell {
}

Future<int> flawless() async {
if (terminalArgs.isEmpty) return stdint('fail');
if (!command.isEmpty) flawlessExec(["--flaw", command]);
return flawlessExec(this.terminalArgs);
return flawlessExec(command);
}

Future<int> unixBox() async {
Future<int> tinybox() async {
if (terminalArgs.isEmpty) return stdint('fail');
return unixToDosExec(this.terminalArgs, this.terminalArgs[0]);
return tinyBox(this.terminalArgs, this.terminalArgs[0]);
}

Future<int> pkgManager() {
Expand Down
3 changes: 2 additions & 1 deletion src/lib/maid_shell/shell.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ Future<int> panzerMaidShell(List<String> terminalArgs) async {
case '--status':
return maidStatus();
case '--flaw':
return flawlessExec(terminalArgs);
if (terminalArgs.length < 2) return stdint('fail');
return flawlessExec(terminalArgs[1]);
case '--install-deps':
return pkg();
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ Future<int> systeminfo(args) async {
}

/// Execute tinybox uni like commands
Future<int> unixToDosExec(List<String> terminalArgs, String option) async {
Future<int> tinyBox(List<String> terminalArgs, String option) async {
final Map tinyBoxCommands = {
'touch': (terminalArgs) => touch(terminalArgs),
'cat': (terminalArgs) => cat(terminalArgs),
Expand Down
8 changes: 4 additions & 4 deletions src/lib/maid_shell/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@ String queryMaker(List<String> terminalArgs) {
return "nothing";
}

Future<int> flawlessExec(terminalArgs) async {
Future<int> flawlessExec(String command) async {
puts('Reminder: Use command string inside quotes, like "command --foo bar"\n',
style: 'bold', color: 'yellow');
if (terminalArgs.length >= 2) {
var out = await Process.run("/bin/sh", ['-c', terminalArgs[1]]);
if (!command.isEmpty) {
var out = await Process.run("/bin/sh", ['-c', command]);
stdout.write(out.stdout);
return out.exitCode;
}
Expand All @@ -165,7 +165,7 @@ Future<int> pkg() async {
var package_list = importDatabaseJson()['deps'];
var not_installed = [];
for (final pkg in package_list) {
var out = flawlessExec(["--flawless", "sudo apt install $pkg -y"]);
var out = flawlessExec("sudo apt install $pkg -y");
if (out != 0) not_installed.add(pkg);
}
if (not_installed.isEmpty) return stdint('ok');
Expand Down
13 changes: 6 additions & 7 deletions src/lib/maid_toolkit/web/attack.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import 'package:panzer_maid/tinybox.dart';
import 'package:panzer_maid/maid_shell/utils.dart';

int dns_scanner(List<String> argsv) {


var shellfindKeyPair
Future<int> dns_scanner(List<String> argsv) async {
var domain = searchKeyValue(argsv, key: 'domain');

var options = [
"A +short",
Expand All @@ -19,8 +17,9 @@ int dns_scanner(List<String> argsv) {
];

for (final opt in options) {
flawlessExec()
var out = await flawlessExec("dig $domain $opt");
if (out != 0) return out;
}


return stdint('ok');
}
4 changes: 2 additions & 2 deletions src/test/panzer_maid_test.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'test_tinybox/test_tinybox_unix_utils.dart';
import 'test_tinybox/test_tinybox_utils.dart';
import 'test_maid_shell/test_dos_utils.dart';
import 'test_maid_shell/test_maid_shell_utils.dart';

void main() {
test_tinybox_utils();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,23 @@ void test_unix_utils() {
MaidShell someMaidShell = MaidShell(
terminalArgs: ['touch', 'test_file.txt'],
);
int result = await someMaidShell.unixBox();
int result = await someMaidShell.tinybox();
expect(result, equals(0));
});

test('executes ls command with fake arguments', () async {
MaidShell someMaidShell = MaidShell(
terminalArgs: ['ls', '-lha'],
);
int result = await someMaidShell.unixBox();
int result = await someMaidShell.tinybox();
expect(result, equals(1));
});

test('executes ls command with FAKE arguments', () async {
MaidShell someMaidShell = MaidShell(
terminalArgs: ['ls', '-lha'],
);
int result = await someMaidShell.unixBox();
int result = await someMaidShell.tinybox();
expect(result, equals(1));
});

Expand All @@ -37,23 +37,23 @@ void test_unix_utils() {
'こんにちは'
],
);
int result = await someMaidShell.unixBox();
int result = await someMaidShell.tinybox();
expect(result, equals(0));
});

test('executes cat command with arguments', () async {
MaidShell someMaidShell = MaidShell(
terminalArgs: ['cat', 'test/artifacts/grepme.txt'],
);
int result = await someMaidShell.unixBox();
int result = await someMaidShell.tinybox();
expect(result, equals(0));
});

test('executes systeminfo command with arguments', () async {
MaidShell someMaidShell = MaidShell(
terminalArgs: ['systeminfo'],
);
int result = await someMaidShell.unixBox();
int result = await someMaidShell.tinybox();
expect(result, equals(0));
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,11 @@ void test_tinybox_utils() {

group('flawlessExec', () {
test('prints reminder and exits with 255 for empty arguments', () async {
var test_string = [];
var test_string = ""; // Empty
expect(await flawlessExec(test_string), equals(255));
});
test('Executes ls -lha and returns 0', () async {
var test_string = ["--raw", "ls -la"];
var test_string = "ls -lha";
expect(await flawlessExec(test_string), equals(0));
});
});
Expand Down

0 comments on commit 1b2de93

Please sign in to comment.