added some nice arguments

This commit is contained in:
2026-04-09 17:18:03 +02:00
parent 0738dec435
commit 596ba4753e
2 changed files with 33 additions and 2 deletions
+32 -1
View File
@@ -1,8 +1,34 @@
#!/bin/python
import sys, getopt, os
def main(argv):
try:
opts, args = getopt.getopt(argv,"hc1:c2:c3:",["comp1=","comp2=","comp3="])
except getopt.GetoptError:
print ('test.py -i <inputfile> -a <address> -p <port>')
sys.exit(2)
for opt, arg in opts:
if opt == '-h':
print ('test.py -i <inputfile> -a <address> -p <port>')
sys.exit()
elif opt in ("-c1","--comp1"):
comp1 = str(arg)
elif opt in ("-c2","--comp2"):
comp2 = str(arg)
elif opt in ("-c3","--comp3"):
comp3 = str(arg)
>>> a = "a133efb38766" >>> a = "a133efb38766"
>>> b = "a0a1a2a3a5a7" >>> b = "a0a1a2a3a5a7"
>>> a.encode().hex() >>> a.encode().hex()
'613133336566623338373636' '613133336566623338373636'
>>> bytes1 = bytes.fromhex( a.encode("utf-8").hex()) >>> bytes1 =
>>> bytes2 = bytes.fromhex( b.encode("utf-8").hex()) >>> bytes2 = bytes.fromhex( b.encode("utf-8").hex())
>>> xored = bytes( b1 ^ b2 for b1,b2 in zip(bytes1,bytes2)) >>> xored = bytes( b1 ^ b2 for b1,b2 in zip(bytes1,bytes2))
>>> xored.hex() >>> xored.hex()
@@ -16,3 +42,8 @@ bytearray(b'\x00\x01R\x02\x04T\x03\x00Y\x02W\x01')
>>> e.hex() >>> e.hex()
'000152020454030059025701' '000152020454030059025701'
if __name__ == "__main__":
main(sys.argv[1:])
+1 -1
View File
@@ -25,7 +25,7 @@ echo '</div>';
echo "</body></html>"; echo "</body></html>";
//$output = "Danny is een hele lieve man"; //$output = "Danny is een hele lieve man"; 9546156603-0
//$output = shell_exec("python hello.py"); //$output = shell_exec("python hello.py");