diff --git a/gornilo/__init__.py b/gornilo/__init__.py index bf17029..9ffc689 100644 --- a/gornilo/__init__.py +++ b/gornilo/__init__.py @@ -1,3 +1,10 @@ from gornilo.actions import Checker, Verdict, CheckRequest, PutRequest, GetRequest from gornilo.new_actions import NewChecker from gornilo.sub_checker import VulnChecker +from gornilo.generators import ( + random_username, + random_password, + random_xkcd_password, + random_text, + random_string, +) diff --git a/gornilo/data/adjectives.txt b/gornilo/data/adjectives.txt new file mode 100644 index 0000000..82041ef --- /dev/null +++ b/gornilo/data/adjectives.txt @@ -0,0 +1,500 @@ +able +acidic +actual +admired +adored +afraid +aged +agile +alarmed +alert +all +amazing +amusing +angelic +angry +annual +antique +anxious +any +apt +arid +average +awful +baggy +bare +barren +belated +beloved +best +better +big +bitter +bland +blank +bleak +blind +blond +boiling +bony +boring +bouncy +bright +brisk +brown +bruised +bubbly +bumpy +buoyant +burly +busy +buttery +buzzing +calm +candid +canine +capital +caring +cheery +chilly +classic +clear +close +closed +cloudy +clumsy +coarse +cold +common +content +cool +creamy +crisp +crooked +crowded +cruel +curly +damaged +dapper +dark +darling +dead +dear +dearest +decimal +deep +dense +devoted +digital +dim +direct +dirty +dismal +distant +dizzy +doting +drab +drafty +dreary +droopy +dry +dual +dull +dutiful +eager +earnest +easy +edible +elastic +elderly +elegant +empty +enraged +entire +envious +equal +ethical +even +evil +excited +exotic +failing +fair +fake +false +fancy +far +faraway +fat +fatal +fearful +feisty +few +filthy +fine +firm +first +fitting +fixed +flaky +flat +flimsy +fluffy +fluid +focused +forked +formal +frail +frank +frayed +free +fresh +frigid +frilly +front +frosty +frozen +frugal +funny +fussy +fuzzy +gaseous +general +gentle +genuine +giant +giddy +gifted +glaring +glass +golden +good +grand +grave +gray +greedy +grimy +grouchy +growing +grown +guilty +gummy +hairy +handy +happy +harmful +harsh +healthy +hearty +hefty +helpful +hoarse +honest +honored +hopeful +hot +huge +humble +hungry +hurtful +husky +ideal +idle +illegal +immense +impish +impure +intent +itchy +jagged +jealous +jittery +joint +joyful +joyous +jumbo +jumpy +kindly +knobby +knotty +known +kooky +lanky +large +last +lasting +late +lavish +lawful +leading +leafy +left +light +likable +likely +limited +limp +linear +liquid +little +lively +lonely +loud +loving +low +lucky +mad +major +male +mammoth +married +meager +mealy +measly +meaty +medical +medium +messy +milky +minty +modern +monthly +mundane +murky +mushy +musty +natural +near +needy +nervous +new +next +nimble +nippy +noisy +nonstop +normal +notable +novel +noxious +numb +nutty +oblong +obvious +odd +offbeat +oily +only +optimal +opulent +orange +organic +ornery +our +oval +overdue +pale +parched +past +pastel +perfect +perky +pesky +petty +phony +pink +pitiful +plain +playful +pleased +plump +plush +pointed +polite +poor +popular +posh +potable +present +pretty +pricey +prickly +prime +prize +puny +pure +pushy +putrid +puzzled +quick +quiet +quirky +radiant +rare +rash +raw +ready +real +recent +red +remote +right +roasted +robust +rosy +rotten +rough +rowdy +ruddy +rundown +rural +rusty +safe +salty +sane +scared +scrawny +secret +serious +several +shabby +shady +sharp +showy +shrill +shy +sick +silent +silky +silly +silver +similar +sinful +single +skinny +sleepy +slight +slimy +slow +slushy +smoggy +smooth +smug +snappy +snoopy +soft +soggy +sore +spry +squeaky +staid +stained +stale +starchy +stark +starry +steel +sticky +stiff +stingy +stormy +striped +strong +stupid +stylish +sudden +sugary +sunny +superb +sweaty +sweet +swift +tall +tart +tasty +tender +tense +tepid +testy +that +thick +thin +those +thrifty +tidy +tight +timely +tiny +torn +total +tough +tragic +trained +tricky +trim +trusty +tubby +ugly +unaware +unfit +unhappy +uniform +unique +unkempt +unlined +unlucky +unripe +unsung +untried +upbeat +upright +urban +used +useful +useless +utter +vacant +vague +vain +valid +vast +vicious +violent +violet +virtual +visible +vital +wan +warlike +warm +warped +wary +watery +wealthy +weary +webbed +wee +weekly +weighty +white +wide +wild +willing +winding +windy +winged +wiry +woeful +woozy +worldly +worn +worried +worst +worthy +wrong +wry +yawning +young +yummy +zany +zigzag \ No newline at end of file diff --git a/gornilo/data/nouns.txt b/gornilo/data/nouns.txt new file mode 100644 index 0000000..f599c74 --- /dev/null +++ b/gornilo/data/nouns.txt @@ -0,0 +1,500 @@ +abroad +access +act +ad +advice +affair +affect +age +agency +agent +air +airline +alarm +alcohol +analyst +anger +angle +annual +anxiety +anybody +arm +army +arrival +art +article +aside +aspect +bad +bag +bake +band +bank +basis +bath +battle +beat +being +bell +belt +bet +big +bike +bird +bit +bite +bitter +blame +blood +blow +blue +board +boat +body +book +border +bottle +bowl +brother +buddy +bug +burn +bus +buy +buyer +cabinet +cable +calm +camera +candy +cap +capital +car +case +cash +catch +cell +chance +channel +chicken +clerk +click +clock +clothes +club +coach +coffee +combine +command +concert +control +convert +cook +cookie +cost +counter +country +court +cover +cow +crazy +cream +credit +cross +cup +curve +cut +dance +day +deal +debate +debt +delay +demand +deposit +design +device +diamond +diet +dog +dot +doubt +draw +drawer +drawing +dream +dress +drop +drunk +dump +duty +ear +east +edge +editor +effort +egg +emotion +end +engine +error +escape +example +excuse +expert +fact +family +fan +farm +farmer +father +fear +feature +feed +feeling +few +fight +figure +final +finger +fish +fishing +fix +flight +flow +foot +front +fruit +fuel +fun +funny +game +garage +garbage +gate +gear +glad +goal +gold +good +grand +great +grocery +ground +group +growth +habit +harm +head +heart +hide +highway +hire +hit +hole +holiday +honey +hook +horror +hurry +ice +if +image +impress +initial +injury +it +item +joint +joke +juice +jury +keep +key +kick +kiss +kitchen +knee +knife +lack +lady +lake +land +laugh +law +lead +leather +lecture +leg +length +letter +lie +life +lip +list +listen +load +loan +local +love +low +lunch +machine +mail +mall +many +march +mark +market +meal +meaning +media +medium +memory +menu +metal +might +minimum +minute +mirror +miss +mission +mobile +mode +mom +moment +money +mother +motor +mouse +mud +nail +nation +natural +nerve +normal +north +nose +note +number +object +office +officer +oil +order +outcome +outside +oven +page +pain +paint +pair +parking +part +passage +passion +pattern +pause +pay +payment +pension +phase +photo +physics +pin +place +plane +plant +play +plenty +poem +policy +pop +post +potato +pound +power +present +press +pride +primary +prize +problem +produce +program +promise +prompt +public +push +rain +raise +range +ratio +read +reason +recipe +record +regret +release +relief +remote +remove +repair +reply +request +reserve +respond +rest +reveal +revenue +reward +rip +rise +river +rock +role +roll +room +round +row +run +sad +salary +sand +save +science +screen +screw +season +secret +section +senior +sense +service +setting +sex +shake +share +shine +shirt +shop +sign +signal +silly +silver +singer +single +site +skill +sky +sleep +slice +slide +smell +smile +society +soft +soil +solid +song +soup +speech +speed +spell +spend +spite +split +sport +spring +square +stable +staff +stand +start +steal +stock +stomach +store +storm +strain +street +stress +stretch +strip +stroke +studio +style +subject +sugar +summer +surgery +sweet +swim +tale +tank +tap +taste +tea +teach +teacher +tear +tell +term +test +thought +throat +till +tip +tongue +tonight +topic +touch +tough +tour +tourist +tower +town +trade +train +trick +truck +truth +two +type +uncle +unit +upper +usual +value +vast +vehicle +video +view +visual +volume +wait +wake +wall +wash +watch +way +wear +week +weekend +weight +weird +welcome +wheel +white +whole +wind +window +wine +wonder +word +working +worry +year +yellow +you +young \ No newline at end of file diff --git a/gornilo/generators.py b/gornilo/generators.py new file mode 100644 index 0000000..198d4f7 --- /dev/null +++ b/gornilo/generators.py @@ -0,0 +1,77 @@ +import os +import string +import random +from typing import Optional, List + + +NOUNS: Optional[List[str]] = None +ADJECTIVES: Optional[List[str]] = None + + +def _load_words() -> None: + global NOUNS, ADJECTIVES + + dir = os.path.dirname(__file__) + + with open(os.path.join(dir, 'data', 'nouns.txt'), 'r') as file: + NOUNS = file.read().strip().split(os.linesep) + + with open(os.path.join(dir, 'data', 'adjectives.txt'), 'r') as file: + ADJECTIVES = file.read().strip().split(os.linesep) + + +def random_string( + length: int = 32, + alphabet: str = string.ascii_uppercase + string.ascii_lowercase + string.digits, +) -> str: + return ''.join(random.choices(alphabet, k = length)) + + +def random_username(random_length: int = 6) -> str: + if NOUNS is None or ADJECTIVES is None: + _load_words() + + random_alphabet = string.ascii_lowercase + string.digits + + adjective = random.choice(ADJECTIVES) + noun = random.choice(NOUNS) + suffix = ''.join( + random.choices(random_alphabet, k = random_length), + ) + + return f'{adjective}_{noun}_{suffix}' + + +def random_password(length: int = 16) -> str: + return random_string(length) + + +def random_xkcd_password(count: int = 6) -> str: + if NOUNS is None: + _load_words() + + return '_'.join( + word.upper() for word in random.sample(NOUNS, k = count) + ) + + +def random_text( + sentences_count: int = 4, + words_in_sentence: int = 6, +) -> str: + if NOUNS is None or ADJECTIVES is None: + _load_words() + + sentences = [] + + for _ in range(sentences_count): + words = [] + + for _ in range(words_in_sentence): + word = random.choice(random.choice([NOUNS, ADJECTIVES])) + words.append(word) + + sentence = ' '.join(words).capitalize() + '.' + sentences.append(sentence) + + return ' '.join(sentences)