forked from P1kachu/v0lt
-
Notifications
You must be signed in to change notification settings - Fork 0
/
examples.py
55 lines (43 loc) · 1.77 KB
/
examples.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import unittest
from v0lt import *
__author__ = 'P1kachu'
class Tests(unittest.TestCase):
def test_netcat(self):
nc = Netcat("archpichu.ddns.net", 65103)
self.assertEqual(nc.read(), "\nNothing to display yet...\n")
def test_telnet(self):
tl = Telnet("archpichu.ddns.net", 65103)
self.assertEqual(tl.read(), "\nNothing to display yet...\n")
def test_stack(self):
stack = Stack()
self.assertEqual(stack.size(), 0)
stack.push("item")
self.assertEqual(stack.is_empty(), False)
self.assertEqual(stack.size(), 1)
item = stack.pop()
self.assertEqual(stack.size(), 0)
self.assertEqual(item, "item")
self.assertEqual(stack.is_empty(), True)
def test_basic_ceasar(self):
plaintext = "This is a ceasar plaintext"
encrypted = "GUVF VF N PRNFNE CYNVAGRKG"
deciphered = basic_ceasar(plaintext, offset=13)
self.assertEqual(encrypted, deciphered)
def test_get_shellcode(self):
sh = ShellCrafter70, "/bin/lol")
sh.get_shellcodes(sh.keywords)
sh = ShellCrafter(70, "/bin/sh")
sh.get_shellcodes(sh.keywords)
def test_flag_gen(self):
flags_gen("flags.tmp", "P1ka", 10)
def test_find_nth(self):
self.assertEqual(find_nth("lolilol", "l", 3), 6)
self.assertEqual(find_nth("lolilol", "l", 4), -1)
def brute(self):
bf = Bruteforce(charset="abcd", final_length=5, begin_with="l", end_with="P")
bf.generate_strings()
bf = Bruteforce(charset="abcdef", final_length=12, begin_with="l", end_with="P")
bf.generate_strings(output="bf.tmp")
if __name__ == "__main__":
suite = unittest.defaultTestLoader.loadTestsFromTestCase(Tests)
unittest.TextTestRunner().run(suite)