One Hat Cyber Team
Your IP :
172.16.0.254
Server IP :
58.26.163.33
Server :
Windows NT DGPENSV2LPKMN 10.0 build 14393 (Windows Server 2016) AMD64
Server Software :
Apache/2.4.46 (Win64) OpenSSL/1.1.1h PHP/7.3.25
PHP Version :
7.3.25
Buat File
|
Buat Folder
Eksekusi
Dir :
C:
/
laragon
/
bin
/
python
/
python-3.10
/
Lib
/
ctypes
/
test
/
Edit File:
test_unaligned_structures.py
import sys, unittest from ctypes import * structures = [] byteswapped_structures = [] if sys.byteorder == "little": SwappedStructure = BigEndianStructure else: SwappedStructure = LittleEndianStructure for typ in [c_short, c_int, c_long, c_longlong, c_float, c_double, c_ushort, c_uint, c_ulong, c_ulonglong]: class X(Structure): _pack_ = 1 _fields_ = [("pad", c_byte), ("value", typ)] class Y(SwappedStructure): _pack_ = 1 _fields_ = [("pad", c_byte), ("value", typ)] structures.append(X) byteswapped_structures.append(Y) class TestStructures(unittest.TestCase): def test_native(self): for typ in structures: self.assertEqual(typ.value.offset, 1) o = typ() o.value = 4 self.assertEqual(o.value, 4) def test_swapped(self): for typ in byteswapped_structures: self.assertEqual(typ.value.offset, 1) o = typ() o.value = 4 self.assertEqual(o.value, 4) if __name__ == '__main__': unittest.main()
Simpan