adding scripts and names to scripts
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
|
# takes in a string in all caps and prints every rotation for it
|
||||||
|
|
||||||
text = input("Enter string in all caps for rot: ")
|
text = input("Enter string in all caps for rot: ")
|
||||||
rot = 0
|
rot = 0
|
||||||
new = 0
|
new = 0
|
||||||
|
|||||||
22
Crimson_Defense/Scripts/cracked_hasher/Hasher.java
Normal file
22
Crimson_Defense/Scripts/cracked_hasher/Hasher.java
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
package database;
|
||||||
|
public class Hasher {
|
||||||
|
private static boolean hash(String paramString) {
|
||||||
|
int i = 7;
|
||||||
|
int j = 593779930;
|
||||||
|
for (byte b = 0; b < paramString.length(); b++)
|
||||||
|
i = i * 31 + paramString.charAt(b);
|
||||||
|
return (i == j);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] paramArrayOfString) {
|
||||||
|
if (paramArrayOfString.length != 1) {
|
||||||
|
System.out.println("Usage: java Hasher <password>");
|
||||||
|
System.exit(1);
|
||||||
|
}
|
||||||
|
if (hash(paramArrayOfString[0])) {
|
||||||
|
System.out.println("Correct");
|
||||||
|
} else {
|
||||||
|
System.out.println("Incorrect");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
3
Crimson_Defense/Scripts/cracked_hasher/README.md
Normal file
3
Crimson_Defense/Scripts/cracked_hasher/README.md
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
# Hasher
|
||||||
|
|
||||||
|
The java script will brute force the hashing function to get the flag
|
||||||
46
Crimson_Defense/Scripts/cracked_hasher/script.java
Normal file
46
Crimson_Defense/Scripts/cracked_hasher/script.java
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
|
||||||
|
|
||||||
|
public class Hasher {
|
||||||
|
|
||||||
|
public static void main(String[] paramArrayOfString) {
|
||||||
|
|
||||||
|
int ans = 593779930;
|
||||||
|
int A, B, C, D, E, F, G, H, I, J, K, L, M;
|
||||||
|
|
||||||
|
int[] caps = {97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
|
||||||
|
119, 120, 121, 122, 45, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 83, 75, 89, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 76,
|
||||||
|
77, 78, 79, 80, 81, 82, 84, 85, 86, 87, 88, 90};
|
||||||
|
|
||||||
|
for(int a = 0; a < caps.length; a++){
|
||||||
|
A = (7 * 31) + caps[a];
|
||||||
|
for(int b = 0; b < caps.length; b++){
|
||||||
|
B = (A * 31) + caps[b];
|
||||||
|
for(int c = 0; c < caps.length; c++){
|
||||||
|
C = (B * 31) + caps[c];
|
||||||
|
for(int d = 0; d < caps.length; d++){
|
||||||
|
D = (C * 31) + caps[d];
|
||||||
|
for(int e = 0; e < caps.length; e++){
|
||||||
|
E = (D * 31) + caps[e];
|
||||||
|
for(int f = 0; f < caps.length; f++){
|
||||||
|
F = (E * 31) + caps[f];
|
||||||
|
for(int g = 0; g < caps.length; g++){
|
||||||
|
G = (F * 31) + caps[g];
|
||||||
|
if(G > 593779000 && G < 593779999){
|
||||||
|
System.out.println(G);
|
||||||
|
}
|
||||||
|
if(G == ans) {
|
||||||
|
System.out.println("Cracked");
|
||||||
|
System.out.println(caps[a] + " " + caps[b] + " " + caps[c] + " " + caps[d] + " " + caps[e] + " " + caps[f] + " " + caps[g]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("Wrong");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
# Cole
|
||||||
#Dirbuster-like script for sites that always return 301
|
#Dirbuster-like script for sites that always return 301
|
||||||
|
|
||||||
import requests
|
import requests
|
||||||
|
|||||||
48
Crimson_Defense/Scripts/file_carving/get-jpegs.py
Normal file
48
Crimson_Defense/Scripts/file_carving/get-jpegs.py
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
# Stephen
|
||||||
|
# Carve out every jpeg within a file
|
||||||
|
import os
|
||||||
|
|
||||||
|
# put name of file
|
||||||
|
file_size = os.path.getsize('Candidates.pdf')
|
||||||
|
print("File Size is :", file_size, "bytes")
|
||||||
|
|
||||||
|
file=open("Candidates.pdf","rb")
|
||||||
|
magic_bytes = b'\xff\xd8\xff\xe0'
|
||||||
|
end_bytes = b'\xff\xd9'
|
||||||
|
image_num = 0
|
||||||
|
name = "image_found_"
|
||||||
|
ext = ".jpeg"
|
||||||
|
jpeg = False
|
||||||
|
|
||||||
|
for i in range(0, file_size):
|
||||||
|
position = file.seek(i, 0)
|
||||||
|
|
||||||
|
if(jpeg == False):
|
||||||
|
position_header = position
|
||||||
|
header = file.read(4)
|
||||||
|
if (header == magic_bytes):
|
||||||
|
print("new image detected")
|
||||||
|
jpeg = True
|
||||||
|
else:
|
||||||
|
position_footer = position + 2
|
||||||
|
footer = file.read(2)
|
||||||
|
if(footer == end_bytes):
|
||||||
|
print("Found end image. Writing image to new file")
|
||||||
|
file_size = position_footer - position_header
|
||||||
|
print(file_size)
|
||||||
|
jpeg = False
|
||||||
|
|
||||||
|
# Create new file to wriet to in binary
|
||||||
|
image_name = name + str(image_num) + ext
|
||||||
|
new_image = open(image_name, "wb")
|
||||||
|
image_num += 1
|
||||||
|
|
||||||
|
file.seek(position_header, 0)
|
||||||
|
data_of_image = file.read(file_size)
|
||||||
|
new_image.write(data_of_image)
|
||||||
|
file.seek(i, 0)
|
||||||
|
new_image.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
file.close()
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
# Cole
|
||||||
#Goal of program is to run a bash command with every permutation of arguments
|
#Goal of program is to run a bash command with every permutation of arguments
|
||||||
#This is useful for a file that has been split up as you can cat each permutation
|
#This is useful for a file that has been split up as you can cat each permutation
|
||||||
#until you arrive at a file that passes some sort of validity check
|
#until you arrive at a file that passes some sort of validity check
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
# Cole
|
||||||
#Custom caesar/rotation cipher solver with custom alphabet
|
#Custom caesar/rotation cipher solver with custom alphabet
|
||||||
|
|
||||||
#Built-in sets to build from
|
#Built-in sets to build from
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# Torrent files
|
||||||
|
You can use this if you have a pcap file containing a torrent file and you want to put it back together</br>
|
||||||
|
To get the pieces you need to follow the stream and get a hex</br>
|
||||||
|
|
||||||
|
to get the count export the pieces to a text file and use the countTorrentPieces script</br>
|
||||||
|
|
||||||
|
To reconstruct use this tshark command in the command line and copy and paste it into a text file</br>
|
||||||
|
Use the readTorrentPieces to read every piece into a construct file</br>
|
||||||
|
tshark -r torrent.pcap -Y 'bittorrent.piece.data and ip.dst_host == 192.168.29.129' -T fields -e frame.number -e frame.time -e frame.len -e ip.src_host -e bittorrent.piece.index -e bittorrent.piece.data -E separator=+</br>
|
||||||
|
|
||||||
|
This command will give some good details on the torrent file. Frames count IS NOT the same as the number of pieces. There can be multiple pieces in a frame.</br>
|
||||||
|
tshark -r torrent.pcap -q -z io,stat,1,"bittorrent.piece.data and ip.dst_host == 192.168.29.129"</br>
|
||||||
|
|
||||||
|
Finally use the constructTorrentPieces to reconstuct the torrent file.</br>
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
# used python3
|
||||||
|
|
||||||
|
import re
|
||||||
|
from ast import literal_eval
|
||||||
|
|
||||||
|
READ = open("pieces.txt", "r")
|
||||||
|
construct = open("reconstruct.txt", "w")
|
||||||
|
|
||||||
|
lines = READ.readlines()
|
||||||
|
|
||||||
|
torrent = {}
|
||||||
|
min = 100000
|
||||||
|
max = 0
|
||||||
|
count = 0
|
||||||
|
fcount = 0
|
||||||
|
|
||||||
|
for line in lines:
|
||||||
|
# filtering out file, just want data
|
||||||
|
pieces = re.search(r'\+.*\+', line)
|
||||||
|
pieces = pieces.group().strip('+')
|
||||||
|
pieces = pieces.split(',')
|
||||||
|
# print(pieces)
|
||||||
|
|
||||||
|
line = line.strip('+')
|
||||||
|
data = re.search(r'\+.*\n', line)
|
||||||
|
data = data.group().rstrip().strip('+')
|
||||||
|
data = data.split(',')
|
||||||
|
# print(data)
|
||||||
|
|
||||||
|
i = 0
|
||||||
|
for piece in pieces:
|
||||||
|
dec = literal_eval(piece)
|
||||||
|
|
||||||
|
if (dec > max):
|
||||||
|
max = dec
|
||||||
|
|
||||||
|
if(dec < min):
|
||||||
|
min = dec
|
||||||
|
|
||||||
|
torrent.update({dec:data[i]})
|
||||||
|
fcount += 1
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
for i in range(min, max+1):
|
||||||
|
x = torrent.get(i)
|
||||||
|
construct.write(x)
|
||||||
|
count += 1
|
||||||
|
|
||||||
|
print("Min was:", min)
|
||||||
|
print("Max was:", max)
|
||||||
|
print("fcount was", fcount)
|
||||||
|
print("count was", count)
|
||||||
|
|
||||||
|
READ.close()
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
# used python3
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
READ = open("pieces.txt", "r")
|
||||||
|
|
||||||
|
lines = READ.readlines()
|
||||||
|
|
||||||
|
count = 0
|
||||||
|
|
||||||
|
for line in lines:
|
||||||
|
# using regex( findall() )
|
||||||
|
# to extract words from string
|
||||||
|
res = re.findall(r'\w+', line)
|
||||||
|
|
||||||
|
for word in res:
|
||||||
|
if(word == "Piece"):
|
||||||
|
count += 1
|
||||||
|
|
||||||
|
print(count)
|
||||||
|
READ.close()
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
# used python3
|
||||||
|
|
||||||
|
import re
|
||||||
|
|
||||||
|
READ = open("rawOutput.txt", "r")
|
||||||
|
construct = open("pieces.txt", "w")
|
||||||
|
|
||||||
|
lines = READ.readlines()
|
||||||
|
|
||||||
|
frames = 0
|
||||||
|
|
||||||
|
for line in lines:
|
||||||
|
frames += 1
|
||||||
|
res = re.search(r'\+0x.*', line)
|
||||||
|
data = res.group()
|
||||||
|
construct.write(data)
|
||||||
|
construct.write('\n')
|
||||||
|
|
||||||
|
print("Done. number of frames were:", frames)
|
||||||
|
READ.close()
|
||||||
Reference in New Issue
Block a user