Page 2 of 2

Re: Python for stealth client

Posted: 02.11.2014 14:13
by nah nah
ни чё он там не пихает, строки кодированы тем, чем кодирован файл

Code: Select all

import ctypes
import sys
import time


dll = ctypes.WinDLL('script.dll')
dll.StartStealthSocketInstance(sys.executable.encode())

time.sleep(0.001)

def AddToSystemJournal(*args, **kwargs):
    sep = kwargs.get('sep', ' ')
    end = kwargs.get('end', '')
    line = ''
    for arg in args:
        line += sep if line != '' else ''
        line += str(arg)
    line += end

    func = dll.Script_AddToSystemJournal
    func.argtypes = ctypes.c_wchar_p,
    func(line)

    time.sleep(0.001)


AddToSystemJournal('asd', 1, 2, (1, 2, 3), 'привет')
AddToSystemJournal('asd', 1, 2, (1, 2, 3), 'привет')
AddToSystemJournal('asd', 1, 2, (1, 2, 3), 'привет')

Code: Select all

13:27:15:331 []: External Script Started
13:27:15:341 []: asd 1 2 (1, 2, 3) привет
13:27:15:351 []: asd 1 2 (1, 2, 3) привет
13:27:15:361 []: asd 1 2 (1, 2, 3) привет
utf-8 без bom

Image

Re: Python for stealth client

Posted: 02.11.2014 15:01
by Vizit0r
оригинально, оригинально...

Re: Python for stealth client

Posted: 02.11.2014 15:46
by nah nah
Vizit0r wrote:оригинально, оригинально...
не понял стёба

Re: Python for stealth client

Posted: 02.11.2014 16:14
by Vizit0r
просто для меня такой подход странен, мягко говоря)))

Re: Python for stealth client

Posted: 02.11.2014 16:49
by nah nah
сам скрипт - юникод, а строки, имена функций итд кодируются в utf-8, кажется... не помню уже. а utf-8 наиболее распространённая кодировка дли питонщиков, почти стандарт.
начинать код надо с нажатия кодировать в utf-8, а готовый код нужно преобразовать (при этом почти всегда ломается всё, что написано не латиницей)

кстати вот корявый способ вывода в сисжурнал

Code: Select all

import ctypes, sys, time


dll = ctypes.WinDLL('script.dll')
dll.StartStealthSocketInstance(sys.executable.encode())

time.sleep(0.001)
stdout = sys.stdout

class Output:
    def __init__(self):
        self.buffer = ''
        self.func = dll.Script_AddToSystemJournal
        self.func.argtypes = ctypes.c_wchar_p,

    def write(self, str):
        if str is '\n':
            self.func(self.buffer)
            self.buffer = ''
            time.sleep(0.001)
        else:
            self.buffer += str

    def flush(self): pass


output = Output()
sys.stdout = output
sys.stderr = output

print(1, 2, 3, 'привет')
print(1, 2, 3, 'привет')
print(1, 2, 3, 'привет')

assert 1 == 2
и ошибки и принт в стелс. скрипты можно заводить без cmd, НО print(1, 2, end='') не будет работать

Re: Python for stealth client

Posted: 03.11.2014 3:49
by Half-Life
Благодаря nah nah проблема была решена. За что ему огромная благодарность. Ошибка заключалось в неправильном запуске скрипта.

Re: Python for stealth client

Posted: 07.11.2014 14:24
by Boydon
Sorry for not speaking russian, but you can find a full dll wrapper of the Script.dll here:
https://bitbucket.org/Stealthadmin/stea ... stealth.py

With this wrapper you have almost 100% compatibility with script written for stealth embedded Python.