예제 #1
0
파일: tests.py 프로젝트: kosii/Szakdolgozat
	def test_QTFile(self):
		with context_managers.filedescriptor('Honeypot/Honeypot.exe', os.O_RDONLY) as fd:
			with contextlib.closing(mmap.mmap(fd, length=0, access=mmap.ACCESS_READ)) as mmapped_file:
				qt_file = qt_meta.QTFile(mmapped_file)
		    	self.assertEqual(len(qt_file.classes), 2)
		    	self.assertEqual([klass.name for klass in qt_file.classes], ['honeypot', 'no_signals'])
		    	self.assertEqual([klass.safe_name for klass in qt_file.classes], ['honeypot', 'no_signals'])
		    	self.assertEqual([klass.metacall_address_name for klass in qt_file.classes], ['honeypot_metacall_address', 'no_signals_metacall_address'])
		    	self.assertEqual([klass.metacall_hook_name for klass in qt_file.classes], ['honeypot_metacall_address_hook', 'no_signals_metacall_address_hook'])
		    	self.assertEqual([klass.metaobject_function for klass in qt_file.classes], [0x401130, 0x401300])
예제 #2
0
파일: main.py 프로젝트: kosii/Szakdolgozat
import scons
import SCons.Script
import workers
from arguments import parser
from qt_meta import QTFile
from context_managers import filedescriptor, restore_cwd, eyecandy
from utils import Eyecandy
import conf

# C:/Users/kosi/AppData/Local/Amazon/Kindle/application/Kindle.exe 
args = parser.parse_args([r'C:\Users\kosii\AppData\Local\Amazon\Kindle\application\Kindle.exe'])
conf.debug = bool(args.debug)

if args.do_not_regenerate:
	with filedescriptor(args.input_file, os.O_RDONLY) as fd:
		with contextlib.closing(mmap.mmap(fd, length=0, access=mmap.ACCESS_READ)) as mmapped_file:
		    with open('injector/injected.cpp', 'w') as injected_dll_source:
		    	print 'Identifying Qt classes in {input_file} ...'.format(input_file=args.input_file)
		    	with eyecandy():
			    	injected_dll_source.write(QTFile(mmapped_file, n=args.n).render())

if args.do_not_recompile:
	with restore_cwd():
		os.environ['SCONSFLAGS'] = "-C injector -Q -s"
		try:
			print "Compiling injected dll ..."
			with eyecandy():
				SCons.Script.main()
		except SystemExit as e:
			if e.code: