Visualizzazione dei risultati da 1 a 7 su 7

Visualizzazione discussione

  1. #1

    [help] semplice crypta stringhe

    Ciao sto cercando di creare un semplicissimo tool per cifrare e decifrare stringhe con xor, ma la funzione che voglio utilizzare è codata in shellcode e vorrei cercare di integrarla nel progetto in vb.net infatti il mio scopo è quello di capire come adattare funzioni natie (originariamente questa funzione xor è stata codata per vb6) tipo VarPtr o StrPtr in vb.NET ecco il codice

    1 form
    3 textbox
    2 bottoni
    1 modulo

    nella form
    codice:
    Public Class frmMain
      
        Private Sub btnEnc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnc.Click
            'encrypt
            Dim chiave As String = "aonyregpnxmtxppm"
            txtEnc.Text = mXOR.ASMXORString(txtClear.Text, chiave)
        End Sub
    
        Private Sub btnDec_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnDec.Click
            'decrypt
            Dim chiave As String = "aonyregpnxmtxppm"
            txtDec.Text = mXOR.ASMXORString(txtEnc.Text, chiave)
        End Sub
    End Class
    nel modulo
    codice:
    Imports System.Runtime.InteropServices
    Imports System.Text
    Module mXOR
        Private Declare Function CallWindowProc Lib "user32" Alias "CallWindowProcW" (ByVal ptrMC As Long, ByVal P1 As Long, ByVal P2 As Long, ByVal P3 As Long, ByVal P4 As Long) As Long
        Private MyByteXor(93) As Byte ' Byte array (hold the ASM ShellCode)
        Private ptrMC As Long 'Byte array Pointer Store Value
    
        Public Function ASMXORString(ByVal Str As String, ByVal Password As String) As String
            Call LeggiCodiceMasm32()
            Call CallWindowProc(ptrMC, Marshal.PtrToStringAuto(Str), Len(Str), Marshal.PtrToStringAuto(Password), Len(Password))
            ASMXORString = Str
        End Function
    
        Public Sub ASMXORByte(ByVal ByteA() As Byte, ByVal Password As String)
            Call LeggiCodiceMasm32()
            Call CallWindowProc(ptrMC, VarPtr(ByteA(0)), UBound(ByteA), Marshal.PtrToStringAuto(Password), Len(Password))
        End Sub
    
    
        Sub LeggiCodiceMasm32()
            MyByteXor(0) = 85
            MyByteXor(1) = 137
            MyByteXor(2) = 229
            MyByteXor(3) = 83
            MyByteXor(4) = 86
            MyByteXor(5) = 87
            MyByteXor(6) = 139
            MyByteXor(7) = 69
            MyByteXor(8) = 12
            MyByteXor(9) = 133
            MyByteXor(10) = 192
            MyByteXor(11) = 116
            MyByteXor(12) = 70
            MyByteXor(13) = 139
            MyByteXor(14) = 69
            MyByteXor(15) = 20
            MyByteXor(16) = 133
            MyByteXor(17) = 192
            MyByteXor(18) = 116
            MyByteXor(19) = 63
            MyByteXor(20) = 139
            MyByteXor(21) = 77
            MyByteXor(22) = 12
            MyByteXor(23) = 209
            MyByteXor(24) = 225
            MyByteXor(25) = 139
            MyByteXor(26) = 85
            MyByteXor(27) = 8
            MyByteXor(28) = 1
            MyByteXor(29) = 202
            MyByteXor(30) = 247
            MyByteXor(31) = 217
            MyByteXor(32) = 139
            MyByteXor(33) = 93
            MyByteXor(34) = 20
            MyByteXor(35) = 209
            MyByteXor(36) = 227
            MyByteXor(37) = 139
            MyByteXor(38) = 69
            MyByteXor(39) = 16
            MyByteXor(40) = 1
            MyByteXor(41) = 216
            MyByteXor(42) = 137
            MyByteXor(43) = 69
            MyByteXor(44) = 16
            MyByteXor(45) = 247
            MyByteXor(46) = 219
            MyByteXor(47) = 137
            MyByteXor(48) = 93
            MyByteXor(49) = 20
            MyByteXor(50) = 139
            MyByteXor(51) = 4
            MyByteXor(52) = 10
            MyByteXor(53) = 3
            MyByteXor(54) = 93
            MyByteXor(55) = 16
            MyByteXor(56) = 50
            MyByteXor(57) = 3
            MyByteXor(58) = 43
            MyByteXor(59) = 93
            MyByteXor(60) = 16
            MyByteXor(61) = 129
            MyByteXor(62) = 195
            MyByteXor(63) = 2
            MyByteXor(64) = 0
            MyByteXor(65) = 0
            MyByteXor(66) = 0
            MyByteXor(67) = 117
            MyByteXor(68) = 3
            MyByteXor(69) = 139
            MyByteXor(70) = 93
            MyByteXor(71) = 20
            MyByteXor(72) = 137
            MyByteXor(73) = 4
            MyByteXor(74) = 10
            MyByteXor(75) = 129
            MyByteXor(76) = 193
            MyByteXor(77) = 2
            MyByteXor(78) = 0
            MyByteXor(79) = 0
            MyByteXor(80) = 0
            MyByteXor(81) = 117
            MyByteXor(82) = 223
            MyByteXor(83) = 49
            MyByteXor(84) = 192
            MyByteXor(85) = 95
            MyByteXor(86) = 94
            MyByteXor(87) = 91
            MyByteXor(88) = 137
            MyByteXor(89) = 236
            MyByteXor(90) = 93
            MyByteXor(91) = 194
            MyByteXor(92) = 16
            MyByteXor(93) = 0
            ptrMC = VarPtr(MyByteXor(0))
    
        End Sub
        ' a delegate that can point to the VarPtrCallback method
        Private Delegate Function VarPtrCallbackDelegate( _
           ByVal address As Integer, ByVal unused1 As Integer, _
           ByVal unused2 As Integer, ByVal unused3 As Integer) As Integer
    
        ' two aliases for the CallWindowProcA Windows API method
        ' notice that 2nd argument is passed by-reference
        Private Declare Function CallWindowProc Lib "user32" _
           Alias "CallWindowProcA" _
           (ByVal wndProc As VarPtrCallbackDelegate, ByRef var As Short, _
           ByVal unused1 As Integer, ByVal unused2 As Integer, _
           ByVal unused3 As Integer) As Integer
    
        Private Declare Function CallWindowProc Lib "user32" _
           Alias "CallWindowProcA" _
           (ByVal wndProc As VarPtrCallbackDelegate, ByRef var As Integer, _
           ByVal unused1 As Integer, ByVal unused2 As Integer, _
           ByVal unused3 As Integer) As Integer
        ' ...add more overload to support other data types...
    
        ' the method that is indirectly executed when calling CallVarPtrSupport
        ' notice that 1st argument is declared by-value (this is the
        ' argument that receives the 2nd value passed to CallVarPtrSupport)
        Private Function VarPtrCallback(ByVal address As Integer, _
              ByVal unused1 As Integer, ByVal unused2 As Integer, _
              ByVal unused3 As Integer) As Integer
            Return address
        End Function
    
        ' two overloads of VarPtr
        Public Function VarPtr(ByRef var As Short) As Integer
            Return CallWindowProc(AddressOf VarPtrCallback, var, 0, 0, 0)
        End Function
    
    End Module
    Navigando qui e li ho letto che StrPtr andrebbe gestita con la classe Marshal ma non ci riesco mi restituisce questo errore:
    error.jpg

    Scusate non ho messo tag nel titolo linguaggio vb.NET ide Visual Studio 2008
    Ultima modifica di kerberos5; 30-12-2014 a 18:41 Motivo: precisazione

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.