Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Re-Generate
A simple and light package for QA development which can generate random strings via RegExr.
Not all RegExr mechanics are available now. But you can use all base methods and generate any string.
1.0.8:
This package is tested with Python 3.9-3.11 and Pypy 3. There are two ways to install the library:
pip install re_generate
git clone https://github.com/Warrfie/re-generate
cd re-generate
python setup.py install
or:
pip install git+https://github.com/Warrfie/re-generate
It is generally recommended to use the first option.
Package is still under development, and it has regular updates, do not forget to update it regularly by calling
pip install re_generate --upgrade
Summary
type | is supported |
---|---|
[] square brackets | √ |
[^] ! square brackets | √ |
{} braces quantifiers | √ |
{i,j} range braces quantifiers | √ |
| or | √ |
() groups | √ |
\n,\s,\d...etc reserved samples | ✖ |
*?,+?,?? greedy quantifiers | ✖ |
*,+,? lazy quantifiers | ✖ |
How generate
from re_generate import re_generate
print(re_generate(r"69[0-9]abc[a-zA-Z]228"))
'693abcb228'
How generate several strings ot once
from re_generate import re_generate_list
print(re_generate_list(r"69[0-9]abc[a-zA-Z]228"), 10)
['694abcO228', '693abcG228', '692abcV228', '696abcy228', '693abca228', '690abcb228', '694abcD228', '696abck228', '696abcJ228', '692abca228']
If you want to use your own library
from re_generate import re_generator
re_generator.char_lib = "你f好п我Э的$中(国*朋Ъ友1234+=\/,."
Sometimes you need generate string without spaces at begin and end, like after .strip() function.
from re_generate import re_generator
re_generator.will_be_stripped = True
In large project you can link that lib throw cfg py file like that
cfg.py
from re_generate import re_generator
re_generator.char_lib = "你f好п我Э的$中(国*朋Ъ友1234+=\/,."
re_generator.will_be_stripped = True
your_func = re_generator.re_generator
and use it in your project
your_code.py
from cfg import your_func
print(your_func(r"69[^0-9]abc[a-zA-Z]22[ 8]"))
'69我abcb228'
FAQs
Package for random data generation via ReGex
We found that re-generate demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.