Skip to content

Game-K-Hack/pycat

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Reverse shell (netcat version python)

DescriptionDemoFunctioning



Description

The reverse shell - also called reverse tunnel - is a computer technique that allows you to redirect the input and output of a shell to a remote computer on a local computer, through a service capable of interacting between the two computers.

Demo

Syntax: python main.py [-r|-c] <HOST>:<PORT>

Start the server first and wait for the client connection

$ python main.py -r 127.0.0.1:5003
                         _
                         \`*-.
                          )  _`-.
                         .  : `. .
                         : _   '  \
                         ; *` _.   `*-._
                         `-.-'          `-.
    ▄███████▄ ▄██   ▄      ;       `       `.       ▄████████    ▄████████     ███
   ███    ███ ███   ██▄    :.       .        \     ███    ███   ███    ███ ▀█████████▄
   ███    ███ ███▄▄▄███    . \  .   :   .-'   .    ███    █▀    ███    ███    ▀███▀▀██
   ███    ███ ▀▀▀▀▀▀███    '  `+.;  ;  '      :    ███          ███    ███     ███   ▀
 ▀█████████▀  ▄██   ███    :  '  |    ;       ;-.  ███        ▀███████████     ███
   ███        ███   ███    ; '   : :`-:     _.`* ; ███    █▄    ███    ███     ███
   ███        ███   ███ .*' /  .*' ; .*`- +'  `*'  ███    ███   ███    ███     ███
  ▄████▀       ▀█████▀  `*-*   `*-*  `*-*'         ████████▀    ███    █▀     ▄████▀

[INFO] PYCAT by Game K
[WAIT] Listening as 127.0.0.1:5003

Start the client

$ python main.py -c 127.0.0.1:5003

When client is started, the remote is updating

...
[ OK ] 127.0.0.1:64815 Connected

┌──(Game_K@Windows)-[C:\Users\Game_K]
└─$

Functioning

The process begins with initializing the remote server, which boots up and begins listening. The client, on the other hand, starts and connects to the remote server. Then the client sends the PID (process id) of the client to the remote server. The remote server, once this PID has been received, sends a "1" to signal its receipt. The client then sends the path to the current working directory. The remote server then sends a command to the client. The client then sends the output of this command to the remote server. This process repeats several times, with the remote server sending commands to the client and the client sending the outputs associated with those commands to the remote server.


Operation diagram