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.
Getting a string from a textfield and returns the parsed content. In general there are 3 types of saparators:
The expected syntax is quite easy and appropriate to the limited space of normal textfields. You can use the brackets '()' or '{}' but they are ignored.
All parsing functions enable the detection of integers and floats if the flag test_number is set True (default).
WARNING: Quotes help you to protect values with spaces but not the characters used for separating elements! This is in particular important to be aware of when using float values with 'decimals' or 'thousands'.
Reads a string and strips spaces and quotes.
def read_value(text,test_number = True)
Reads a comma separated list and returns either the items or the remainder of the additional list when a text contains the modifier 'Not'. If only ['All','all','ALL'] is found then the value_list is returned.
def read_list(text,value_list=None,sep = ',',modifier_list_not=None,test_number = True)
**Simple list: **
-> ['Hello', 'a list', 'separated by', 'me']
Not list
to
['Audi', 'VW', 'Skoda', 'Peugeot']
Reads a 'outer_sep'-separated list of a mapping with 'inner-sep' separated list and returns a dictionary with the map as key and a list as value.
read_dict_of_list(text,inner_sep = ',',outer_sep = ';',map_sep=':',test_number = True)
"'Mercedes':expensive, German, respectable; Audi:'sportive, German, technology-advanced'; VW : 'people', 'solid', No1; Citroen:cool, Fantomas, CV2, elastic ; 'Rolls Rocye': royal,British, 'very expensive', black"
to
{'Mercedes': ['expensive', 'German', 'respectable'], 'Audi': ['sportive', 'German', 'technology-advanced'], 'VW': ['people', 'solid', 'No1'], 'Citroen': ['cool', 'Fantomas', 'CV2', 'elastic'], 'Rolls Rocye': ['royal', 'British', 'very expensive', 'black']} Map :{'Mercedes': 'expensive', 'Audi': 'sportive', 'VW': 'people', 'Citroen': 'cool', 'Rolls Rocye': 'royal'}
Reads a comma separated list of mappings and returns a dictionary.
def read_dict(text, sep =',', map_sep=':', test_number = True)
"'Mercedes':expensive, Audi:'sportiv', VW : 'people', Citroen:cool, 'Rolls Rocye': royal"
to
{'Mercedes': 'expensive', 'Audi': 'sportiv', 'VW': 'people', 'Citroen': 'cool', 'Rolls Rocye': 'royal'}
Reads a dictionary of dictionaries and returns a dictory with a 2-level hierarchy.
def read_dict_of_dict(text, sep=',', map_sep=':', outer_sep = ';', test_number = True)
"'High Class':{'Mercedes':expensive,'BWM':'sporty};'Sport Class': Porsche:'None',Ferrari:special; 'Middle Class':{VW : 'people','Renault':'fashionable',Citroen:'classy, 'Peugeot':'modern'};'Luxury Class':{'Rolls Rocye': royal, Bentley:'rare'}; 'All:{4:8.9,6:90,7:7}"
to:
{'High Class': {'Mercedes': 'expensive', 'BWM': 'sporty'}, 'Sport Class': {'Porsche': None, 'Ferrari': 'special'}, 'Middle Class': {'VW': 'people', 'Renault': 'fashionable', 'Citroen': 'classy', 'Peugeot': 'modern'}, 'Luxury Class': {'Rolls Rocye': 'royal', 'Bentley': 'rare'}, 'All': {4: 8.9, 6: 90, 7: 7}}
Reads a json formatted string and return a dictionary
"{"Luxury Class": {"Mercedes":"expensive","Rolls Rocye": "royal"}, "High Middle Class":{"Audi":"sportiv"}, "Middle Class" : {"Citroen":"cool","VW" : "people" }}"
to
{'Luxury Class': {'Mercedes': 'expensive', 'Rolls Rocye': 'royal'}, 'High Middle Class': {'Audi': 'sportiv'}, 'Middle Class': {'Citroen': 'cool', 'VW': 'people'}}
Parses a list of comparisons and returns a list of lists with 3 items: (left, comparison-operator, right). There is an internal mapping of comparison characters: {'!=':'!','==':'=','>=':'≥','=>':'≥','<=':'≤','=<':'≤'}
def read_comparisons(text,sep = ',',formula_map = None)
' anna > 1.70, norbert != 900, cindy <= 1.65'
to
[['anna', '>', 1.7], ['norbert', '!', 900.0], ['cindy', '≤', 1.65]]
FAQs
Parsing Textfields
We found that textfield-parser 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.