Rename project to collectionparser

This commit is contained in:
StasonJatham committed 2026-09-19 13:45:37 +02:00
1 parent 997df90c21
commit 3205ab2311
26 files changed
+1285 -1420

No files matched your search

+13 -18
View File
@@ -1,16 +1,8 @@
import unittest
from time import time
from breach.parser import LineParser
from breach.splitter import get_output_file
from breach.utils import alpha_num_lookup
from breach.cparser import c_parseline
p_fast = c_parseline
p_slow = LineParser.parseline
p = p_fast
from collectionparser.parser import parseline as p
from collectionparser.splitter import get_output_file
class ParserTest(unittest.TestCase):
@@ -53,6 +45,10 @@ class ParserTest(unittest.TestCase):
self.assertIsNone(p('ESSENTIALWAY'))
self.assertIsNone(p('ESTARRON-ESPINOSA'))
self.assertIsNone(p('ERLONMIRANDA:sha98ne'))
# No '@' and no '%40' -> cannot yield a pair, must stay None.
self.assertIsNone(p('no at sign at all'))
self.assertIsNone(p('plain text line:with:colons'))
self.assertIsNotNone(p('user%40domain.com:password')) # %40 still becomes '@'
self.assertIsNotNone(p('[email protected]:[email protected]:victory'))
self.assertIsNotNone(p('[email protected];;shanmuga6'))
self.assertIsNotNone(p('[email protected]::shanmuga6'))
@@ -109,7 +105,7 @@ class ParserTest(unittest.TestCase):
def test_parse_2(self):
t = time()
for i in range(20000): # 10,000 * 13 = 130,000 in 4.0 seconds.
for _ in range(20000): # 10,000 * 13 = 130,000 in 4.0 seconds.
# => 32B in in 10 days. That's a lot.
p('[email protected]:123')
p('hello@@gmail.com:123')
@@ -128,13 +124,12 @@ class ParserTest(unittest.TestCase):
print(time() - t)
def test_parse_3(self):
alpha = alpha_num_lookup()
self.assertEqual('j/o/s', get_output_file(alpha, 'josemariacanyero@hotmail.com'))
self.assertEqual('c/e/o', get_output_file(alpha, 'ceo21w@gmail.com'))
self.assertEqual('x/symbols', get_output_file(alpha, '[email protected]'))
self.assertEqual('x/a/symbols', get_output_file(alpha, 'xa_fear_238@hotmail.fr'))
self.assertEqual('x/symbols', get_output_file(alpha, 'x@hotmail.com'))
self.assertEqual('k/e/v', get_output_file(alpha, '[email protected]'))
self.assertEqual('j/o/s', get_output_file('[email protected]'))
self.assertEqual('c/e/o', get_output_file('ceo21w@gmail.com'))
self.assertEqual('x/symbols', get_output_file('x_fear_238@hotmail.fr'))
self.assertEqual('x/a/symbols', get_output_file('xa[email protected]'))
self.assertEqual('x/symbols', get_output_file('x@hotmail.com'))
self.assertEqual('k/e/v', get_output_file('kevmedic13@yahoo.com'))
if __name__ == '__main__':