diff --git a/c/meterpreter/Makefile b/c/meterpreter/Makefile index 1e24f0d9..67b60262 100644 --- a/c/meterpreter/Makefile +++ b/c/meterpreter/Makefile @@ -10,10 +10,10 @@ objects += source/bionic/compiled/libssl.so objects += source/bionic/compiled/libsupport.so objects += source/bionic/compiled/libmetsrv_main.so objects += source/bionic/compiled/libpcap.so -#objects += data/meterpreter/msflinker_linux_x86.bin -#objects += data/meterpreter/ext_server_stdapi.lso -#objects += data/meterpreter/ext_server_sniffer.lso -#objects += data/meterpreter/ext_server_networkpug.lso +objects += data/meterpreter/msflinker_linux_x86.bin +objects += data/meterpreter/ext_server_stdapi.lso +objects += data/meterpreter/ext_server_sniffer.lso +objects += data/meterpreter/ext_server_networkpug.lso BIONIC=$(PWD)/source/bionic LIBC=$(BIONIC)/libc diff --git a/c/meterpreter/data/meterpreter/.keep b/c/meterpreter/data/meterpreter/.keep new file mode 100644 index 00000000..e69de29b diff --git a/c/meterpreter/tools/so2h.pl b/c/meterpreter/tools/so2h.pl new file mode 100644 index 00000000..8fc7351d --- /dev/null +++ b/c/meterpreter/tools/so2h.pl @@ -0,0 +1,154 @@ +#!/usr/bin/perl -w + +if ($#ARGV != 1) { + print "so2h.pl \n"; + exit 1; +} + +my $success; +my $number_read; +my $buffer; +my $is_compressed = 0; +my $compressedname = $ARGV[0]; +my $uncompressedsize; +my $compressedsize; + +$success = open INPUT, "file -bi $ARGV[0]|"; +unless ($success) { + die "failed to open input from file \n"; + exit 1; +} + +$number_read = read(INPUT, $buffer, 32); +if ($buffer =~ "application/x-gzip") { + $is_compressed = 1; +# +# determine file size +# + my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, + $atime,$mtime,$ctime,$blksize,$blocks) + = stat($ARGV[0]); + $compressedsize = $size; + +# +# figure out how big the file is uncompressed +# + my @pathlist = split('/', $ARGV[0]); + my $filename = $pathlist[$#pathlist]; + $uncompressedname = "/tmp/$filename"; + system("gunzip -c $ARGV[0] > $uncompressedname"); + ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, + $atime,$mtime,$ctime,$blksize,$blocks) + = stat($uncompressedname); + $uncompressedsize = $size; + unlink($uncompressedname); +} else { +# +# how big is original uncompressed file? +# + my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, + $atime,$mtime,$ctime,$blksize,$blocks) + = stat($ARGV[0]); + $uncompressedsize = $size; + +# +# compress file and determine its size +# + my @pathlist = split('/', $ARGV[0]); + my $filename = $pathlist[$#pathlist]; + + $compressedname = "/tmp/$filename.gz"; + system("gzip -nfc $ARGV[0] > $compressedname"); + ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, + $atime,$mtime,$ctime,$blksize,$blocks) + = stat($compressedname); + $compressedsize = $size; + +} + +close INPUT; + +$success = open INPUT, "$compressedname"; +unless ($success) { + die "failed to open input file $compressedname\n"; + exit 1; +} +$success = open OUTPUT, ">$ARGV[1].h"; +unless ($success) { + print "failed to open output\n"; + exit 1; +} + + +my $license = < 0) { + print OUTPUT "\t"; + $neednewline = 1; +} +for (; $i < $compressedsize; $i += 1) { + $number_read = read(INPUT, $binary, 1); + my $a = unpack("C", $binary); + $buf = sprintf("U 0x%02X, ", $a); + print OUTPUT $buf; +} + +if ($neednewline) { + print OUTPUT "\n"; +} +print OUTPUT "};\n"; + +# unlink temporary compressed file + +if ($is_compressed == 0) { + unlink($compressedname); +}