Skip to content

Instantly share code, notes, and snippets.

View Tony3-sec's full-sized avatar

Tony36 Tony3-sec

View GitHub Profile
#!/usr/bin/python
## Converts hex to decimal
# Dictionary for hexadecimal. Covers both lower case and upper case.
hexDict = {'a':10, 'b':11, 'c':12, 'd':13, 'e':14, 'f':15, 'A':10, 'B':11, 'C':12, 'D':13, 'E':14, 'F':15}
result = 0
# Get user input
myhex = raw_input('Enter hex: ')
# Reverse the input
myhex = myhex[::-1]
@Tony3-sec
Tony3-sec / add_shenbang_02.sh
Last active November 5, 2015 08:56
Add shenbang to scripts according to file extension. Revised to work in Mac OS-X.
#!/bin/bash
## This script will read the file extension and add proper shenbang to the script
# Exit if no args
if [ $# -eq 0 ]; then
echo "Usage: $0 [filename]"
exit 1
fi
for file in $@
do
#!/usr/bin/python
## Escape dots in domain name or IP address
## You can put multiple domains/IPs split by space
domainIP = raw_input('Enter domain or IP: ')
domainIPList = domainIP.split(' ')
for i in domainIPList:
i = i[::-1].replace('.', '].[', 1)
print(i[::-1])
@Tony3-sec
Tony3-sec / xor.py
Last active November 15, 2015 01:55
XOR encode the user input with arbitary key
#!/usr/bin/python
## Simple xor encoder
def simpleXOR():
result = ''
data = raw_input('Enter data: ')
key = raw_input('Enter key: ')
for i in data:
result += chr(ord(i) ^ int(key))
Hex Decimal Type
-------------------------------
0x14 20 ChangeCiperSpec
0x15 21 Alert
0x16 22 Handshake
0x17 23 Application Data
Reference
http://blog.asial.co.jp/iphone/820
http://www.w3.org/Graphics/GIF/spec-gif89a.txt
0000000: 4749 4638 3961 3303 cc01 f700 00ff ffff GIF89a3.........
0000010: ffff ffff ffff ffff ffff ffff ffff ffff ................
0000020: ffff ffff ffff ffff ffff ffff ffff ffff ................
0000030: ffff ffff ffff ffff ffff ffff ffff ffff ................
0000040: ffff ffff ffff ffff ffff ffff ffff ffff ................
0000050: ffff ffff ffff ffff ffff ffff ffff ffff ................
#!/bin/bash
## Convert hex to decimal
if [ $# -ne 1 ]; then
echo "Usage: $0 [hex data]"
exit 1
fi
head=0x
#!/bin/bash
## Convert filesize and deletion date from recycle bin hex data
f_flag=0
d_flag=0
usage() {
echo "Usage: $0 [-f filesize in hex] [-d deletion date in hex]"
exit 1
## Starting with the .NET Framework 4.5, the DeflateStream class uses the zlib library.
https://msdn.microsoft.com/en-us/library/system.io.compression.deflatestream(v=vs.110).aspx
78 01
78 5e
78 9c
78 da
Above is the typical header for zilb compressed data but does not mean it always start with 78.
Could be start from these numbers as well.
ファイルのタイムスタンプには4種類ある。
Create - the time when the file was created (ファイルの作成日時)
Access - the last time the file was read (ファイルが最後に読まれた日時)
Modify - the last time the file was modified (content has been modified) (ファイルの中身が最後に更新された日時)
Change - the last time meta data of the file was changed (e.g. permissions) (ファイルの属性(読み書きの権限など)が最後に更新された日時)
またファイルにはStandard Information Attribute と FileName Attributeの2種類の属性がある。
Standard Information Attributeは簡単に編集することが可能。