This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Miscellaneous snippets | |
# Author: op | |
### BASH * remove spaces in binary string, then convert it to hex, and add 0x format for every 2 hex chars. | |
### output sent to xxd for hex to ascii conversion | |
echo "obase=16; ibase=2; `./.trash/bin | sed 's/ //g'` " | bc | sed 's/../0x\0/g' | xxd -r | |
### GDB * Only disassemble MAIN section of binary using gdb | |
gdb -batch -ex 'set disassembly-flavor intel' -ex 'file /home/leviathan2/printfile' -ex 'disassemble main' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Continuation from cdkey2 asm practice, this time we look at simple function call | |
; and try to interpret what this asm code does. | |
; esi = cdkey | |
mov ebp, 13AC9741h ; ebp = 0x13AC9741 | |
mov ebx, 0Bh ; ebx = 11 | |
top: | |
movsx eax, byte ptr [ebx+esi] ; eax = cdkey[ebx] | |
push eax ; arg for function call |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;Continuation from previous cdkey asm, this time I try to understand the next variation in asm code. | |
lea edi, [esi + 0xb] ; edi = address of cdkey[0 + 11], address of 12th digit | |
mov ecx, 0xc2 ; ecx = 194 | |
top: | |
mov eax, ecx ; eax = 194 or 0xc2 | |
mov ebx, 0xc ; ebx = 12 | |
cdq ; Convert eax from Double word to Quadruple word. so eax becomes edx:eax | |
; this also zero out any value previously in edx. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
segment .data | |
cdkey db "1111111111111" | |
segment .text | |
global _start | |
_start: | |
mov ecx, cdkey | |
mov eax, 3 ; eax = 3 | |
mov esi, ecx ; esi = ecx, ecx = 13 digit starcraft cd key entered |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# shellcode disassembler using capstone engine | |
# source = http://hacktracking.blogspot.com.au/2015/05/execute-shellcode-in-python.html | |
from sys import argv, exit | |
from capstone import * | |
if len(argv[:]) < 3: | |
print("\nUsage: {} [ARCH] [MODE] ['shellcode']\n".format(argv[0])) | |
exit(0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# author: op. | |
''' | |
create short ping sweep script of your local subnet using a higher level | |
programming language such as Python, Ruby or Perl. | |
''' | |
from multiprocessing import Pool | |
import subprocess as sub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# Copyright 2010 Google Inc. | |
# Licensed under the Apache License, Version 2.0 | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# Google's Python Class | |
# http://code.google.com/edu/languages/google-python-class/ | |
''' | |
Used argparse instead of using sys.argv and also opted for |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# Copyright 2010 Google Inc. | |
# Licensed under the Apache License, Version 2.0 | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# Google's Python Class | |
# http://code.google.com/edu/languages/google-python-class/ | |
import sys | |
import re |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
# Copyright 2010 Google Inc. | |
# Licensed under the Apache License, Version 2.0 | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# Google's Python Class | |
# http://code.google.com/edu/languages/google-python-class/ | |
import os | |
import re |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python -tt | |
# Copyright 2010 Google Inc. | |
# Licensed under the Apache License, Version 2.0 | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# Google's Python Class | |
# http://code.google.com/edu/languages/google-python-class/ | |
"""Mimic pyquick exercise -- optional extra exercise. | |
Google's Python Class |