-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add script name_check #4
Conversation
check_nickname_sync and check_nickname_async in it add social_networks.txt
check_nickname_sync and check_nickname_async in it add social_networks.txt
# Conflicts: # main.py # src/core/base/osint.py # src/core/runner/runner.py # src/scripts/other/simple_example/__main__.py # src/scripts/other/user_greeting/__main__.py
add many files
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Нужно:
- Пройтись по коду скрипта линтером (
pip3 install black
) - Оптимизировать импорты (есть в ревью замечание)
- Поправить некоторые моменты из ревью
- Разобраться, почему записи в .txt повторяются?
|
||
class networks: | ||
def __init__(self): | ||
with open("./src/scripts/osint/check_nickname/social_networks.txt") as f: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Тут есть один не очень хороший side-effect, а именно - если модуль будет запускаться не от основного
main.py
файла И/ИЛИ структура внутренних папок поменяется и что-то по пути изменится, то мы уже не сможем открыть файлsocial_networks.txt
. - Best practice: не писать пути к файлам в виде строчек, для такого есть библиотека pathlib:
from pathlib import Path
Path("./some/path").joinpath("with_some_file.txt")
- Ещё одна вещь - лучше не открывать файл с контекстными менеджерами и прочим-прочим прямо в ините, будет здорово если для этого ты будешь использовать отдельную приватную функцию внутри класса, например:
def __open_file(self, path: Path or str = Path("путь_до_файла"), filename: str = "social_networks.txt") -> list:
...
Что-то типа такого, думаю, идею ты понял :) Можешь поправить как хочешь.
Что нужно сделать?
Соответственно, нужно брать не полный путь до файла от запускаемого скрипта, а относительный путь по принципу: "файл лежит там же, где и мой скрипт __main__.py
"
Ниже я приведу более "правильный" вариант, который будет более универсальным.
result = {username : temp_temp_result} | ||
return ScriptResponse.success( | ||
result=result, | ||
message="yeah" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Надо написать нормальный месседж по результатам выполнения
"""if __name__ =="__main__": | ||
srcipt_module = Runner() | ||
srcipt_result = asyncio.run(srcipt_module.run(username="admin")) | ||
print(srcipt_result) | ||
""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Это либо раскомментить и убедиться, что всё работает, либо удалить.
ok.ru/ | ||
twitter.com/ | ||
vk.com/ | ||
ok.ru/twitter.com/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Как такая ссылка возможна?
twitter.com/ | ||
vk.com/ | ||
ok.ru/ | ||
twitter.com/ | ||
vk.com/ | ||
ok.ru/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Почему ссылки повторяются?
from src.core.utils.response import ScriptResponse | ||
from src.core.utils.validators import validate_kwargs | ||
|
||
|
||
class Runner(OsintRunner): | ||
class Runner(BaseRunner): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Справедливо, но только валидатор всё равно будет валидировать OsintRunner аргументы (посмотри на строку 19 в скрипте):
@validate_kwargs(PossibleKeys.KEYS)
def run(self, *args, **kwargs) -> ScriptResponse.success or ScriptResponse.error:
Поэтому, если используем BaseRunner, валидатор в скрипте отключаем, если OsintRunner - то оставляем.
В данном случае, валидатор тогда нужно удалить (декоратор убрать).
Ну и раз уж simple_example поправил, то нужно и user_greeting зафиксить, убрать декоратор, пофиксить родительский класс.
fix social_networks.txt
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Стало намного лучше! Внес небольшие изменения: 40db700
А в остальном ок. Всё ещё советую поставить PyCharm для оптимизации импортов.
* WIP: Add Initial Version (alpha-beta-gamma) (#1) * Add initial WIP project version * Update src code * Update documentation * Add requirements * add script name_check (#4) * Add initial WIP project version * add check_nickname.py, check_nickname_sync and check_nickname_async in it add social_networks.txt * add check_nickname.py, check_nickname_sync and check_nickname_async in it add social_networks.txt * new main.py * new base: develop add many files * fix inheritance in Runner * fix check_nickname fix social_networks.txt * Little fixes * Return default main value Co-authored-by: manmolecular <regwebghost@yandex.ru> * Add script: region check (#5) * Added number to Possiblekeys in osint.py. Added number as kwarg in main.py. Script defines the region where the phone number is registrated * Changed number->phone * Little fixes, update requirements Co-authored-by: manmolecular <regwebghost@yandex.ru> * add script (email_verifier) (#7) * add script (email_verifier) * add library * change req and so on * used black * Little fixes * Main and .gitignore fixes Co-authored-by: Minerm <minerm@mail.ru> Co-authored-by: manmolecular <regwebghost@yandex.ru> * Add script to get allowed http methods. (#10) * Add script to get allowed http methods. * 'Handle' more probable exceptions * Changed name of script directory * Remove wildcard import * Add random method check. Alter script response. * Little fixes * Fix methods variable * Fix typo in requirements Co-authored-by: manmolecular <regwebghost@yandex.ru> * Add script to calculate hash of favicon.ico for Shodan (#13) * Add script to calculate hash of favicon.ico * Remove '\n' * Change variable name * Core fixes. Provide global variables. Update runner. Upgrade module-package system. (#14) * Clean init all the modules with the __init__.py file * Remove unused gitkeeps * Add base inits for script packages * Update main file * Set __file__ variable at the module level * Add inits for the modules * Modify all the modules * Delete one more .gitkeep * Add WIP test for user_greeting * Update test module for user_greeting * Fix module runner a bit * Add relative imports to the modules * Add run tests script * Update README.md * Fix module-package runner * Update requirements * Format everything with Black * Handle module and execution errors with runner * Awesome cookie checker (#6) * made cookie checker task * added requirements.txt * refactored the code & adapted to the new project structure * small fix that processes exception * Little fixes Co-authored-by: manmolecular <regwebghost@yandex.ru> * Added a function for retrieving location and provider info by IP address. (#12) * Added IP address as one of the possible keys. * Init commit. * Init commit. * Added dosctring. * Removed some emptry lines. * get_ip_info was moved into Runner class. * The IP key shouldn't be here. * Reworked exception handling mechanism. * Codestyle fix. * Removed some test code. * Moved script to proper dir. * Fixed response returned in case of error. * Fixed exception handling. * Request now uses the validated IP. * Found a better variable name for validated IP. * Removed unnecessary variables. * Init commit. * Runner class was moved into this module. * Set default IP to Google DNS Resolver address (to be more stable) * Add default values; set default ip to 8.8.8.8; set default city to Ashburn * Apply Black linter on the main module file Co-authored-by: manmolecular <regwebghost@yandex.ru> * Add simple server mocking test example (#20) * Add simple web server mocking example * Add some types * Add tests for favicon hash (#22) * Add tests for favicon hash * Apply Black linting * Suppress server output logging Co-authored-by: manmolecular <regwebghost@yandex.ru> * Test allowed_methods. Modify allowed_methods. (#21) * * Make allowed_methods also return methods on which server did not response. * Add tests for allowed_methods module. * Fix output * Change docstring * Linting with Black Co-authored-by: manmolecular <regwebghost@yandex.ru> * Fix tests timeouts (#25) * Add tests defaults (#26) * Boost up/improvement: Add multiprocessing CaseManager (processes, threads, parallel case execution) (#27) * Add multiprocessing CaseManager * Add more info about case to the manager * Update logging format * Set optimal threads and processes quantity * simple email generator (#9) * Made simple email generator, modified requirements.txt * deleted __main__ rubbish, modified success message * added a check on username availability * Update __main__.py * Update __main__.py * modified names of methods and atributes * Update requirements.txt * reduced number of domen names, possible emails; reduced reversing and optimized code; moved project to convert/ dir; led project to a new view * fixed bug with command prompt; got rid of json; moved service symbols to a separate class; optimized code; made cosmetic changes * some fixes * some fixes * Add fixes Co-authored-by: manmolecular <regwebghost@yandex.ru> * Added phone number generator and normaliser script file (#11) * Added phone number generator and normaliser script file * Added feature directory and empty files * Added module.py * Added Runner class to main.py * Cleaned up the comments and reformatted code * Added library to the main requirements.txt * Changed module.py * Changed module.py * Deleted old script file * Fixed requirements bug * Add phone_num_generator module * Corrected double brackets and dot format mistakes * Something went wrong last time, so no2 * Added unittests and local number format * Fix main module runner * Remove code duplicate Co-authored-by: manmolecular <regwebghost@yandex.ru> * Get title (#23) * add main code * add __init__.py,__main__.py,module.py,test_module.py * fix module.py fix test_module.py * add test_module.py * add requirements.txt * fix tests,module.py add new lines in __main__.py and __init__.py * Remove old format string * Delete test_module from check_nickname * Module fixes Co-authored-by: manmolecular <regwebghost@yandex.ru> * Suppress Requests keep-alive socket warnings (#33) * Iknowwhatyoudownload (#24) * added torrent module * underscores bugfix * added docstrings * updated requirements * changed directory * Added required changes * Fix base runners * Remove API key, fix main runner * Linting with Black Co-authored-by: omarkelov <36790281+omarkelov@users.noreply.github.com> Co-authored-by: Anton Nikolaev <regwebghost@yandex.ru> * add test_module.py in email_verifier (#29) * add test_module.py * Add functions (test_pass_false / true_arguments) * Fix comparison * Fix return types Co-authored-by: Minerm <minerm@mail.ru> Co-authored-by: manmolecular <regwebghost@yandex.ru> * Fix validator keys (#35) * Develop: fixes, improvements, etc. (#36) * Suppress insecure request warning messages * Update requirements.txt * Add base scenario, add yaml support * Update structure; include results saving * Improvements - skip not applicable scripts, fix workers system (#39) * Fix executors * Optimize imports * Add results to gitignore * Add 'required' field to define required args * Ignore results from 'results' directory * Add 'required' field to base classes * Skip not applicable scripts * Fix quantity of processes * Set the execution timeout to 5 mins per case * Add phone case to the examples * JSON Russian language and encoding support * Add core default values * Remove hardcoded quantity of workers * Increase quantity of cases up to 10 * Fix indentation in runner * Add seed (initial) data to scan for * Email generator fix and tests (#38) * added tests * fixed incorrect behavior * extension of tests, cosmetic changes * Add google_search module (#37) * Add module scraping search results. * Add tests to google_search script * Add tests and do minor refactoring * Add input type test * Apply black linting * Add request delay when needed * Remove redundant import * Fixes (#40) * Add 'required' field for the google search module * Add beatifulsoup to requirements * Check nickname (#28) * add main code * add __init__.py,__main__.py,module.py,test_module.py * fix module.py fix test_module.py * add test_module.py * add requirements.txt * fix tests,module.py add new lines in __main__.py and __init__.py * add test_module.py * delete get_title * add some tests to test_module.py fix social_networks.txt * fix styles modify social_networks.txt * fix module.py fix test_module.py * Cosmetic fixes Co-authored-by: manmolecular <regwebghost@yandex.ru> * Update README.md * Add Tornado-based web-server. Support REST API methods. Implement task manager. (#41) * Modify environment files * Move saver to another module * Add SQLite database handling * Add Tornado server * Add main server runner * Move saver to another module * Add multiprocessing * Add docker-compose and postgres * Update database handling * Update environment files * Remove unused imports from main.py * Update database handlers * Update task manager; handle task status * Fix task spawner * Little cosmetic fixes, format files * Format with Black * Add environment variables * Add limit parameter to the task list handler * Don't initialize task spawner, it's not required * Remove single case wrapper from the main.py * Add Docker support for server * Fix makefile: spaces to tabs * Format with Black * Cosmetic: add new line to dockerignore * Add healthcheckers * Add CLI interface * Add color logging * Update gitignore * Add parents for scripts in logging * Fix makefile * Add screenshots * Update README.md * Update README.md Co-authored-by: Iandmee <48530455+Iandmee@users.noreply.github.com> Co-authored-by: sph-668 <68100447+sph-668@users.noreply.github.com> Co-authored-by: Neo <55306931+Shas08@users.noreply.github.com> Co-authored-by: Minerm <minerm@mail.ru> Co-authored-by: Nikita Kryukov <cravtos92@gmail.com> Co-authored-by: HochuOlivie <49933393+HochuOlivie@users.noreply.github.com> Co-authored-by: Timur <36272321+SN4KEBYTE@users.noreply.github.com> Co-authored-by: Matvey Sergeev <47077074+Enhisir@users.noreply.github.com> Co-authored-by: marinepalyan <50265835+marinepalyan@users.noreply.github.com> Co-authored-by: katerina <42969775+edubinskaya18214@users.noreply.github.com> Co-authored-by: omarkelov <36790281+omarkelov@users.noreply.github.com>
No description provided.