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.
Read/write lists and maps (two dimensional lists) from/to files.
When reading a list or map, lines starting with a hash sign (#
) are considered
to be comments and therefore ignored.
Install ListIO using pip:
pip install listio
import listio
listio.write_list(
'mylist.txt',
['foo', 'bar', 'baz']
)
mylist.txt now contains:
foo
bar
baz
mylist.txt:
First item
second item
foo
# this is a comment
bar
Read mylist.txt
as an iterator:
>>> import listio
>>> mylist = listio.read_list('mylist.txt')
>>> list(mylist)
['First item', 'second item', 'foo', 'bar']
import listio
listio.write_map(
'mymap.csv,
[['foo bar', 'baz', 'x'], [1, 2, 3]]
)
mymap.csv now contains:
foo bar;baz;x
1;2;3
The default CSV delimiter is ;
and lineterminator \n
. You can change this:
listio.write_map(
'mymap.csv,
[['foo bar', 'baz', 'x'], [1, 2, 3]],
delimiter=',',
lineterminator='\r\n'
)
mymap.csv:
First column;"second column";3
# this is a comment
"next;item,";foo;bar
Read mymap.csv
as an iterator:
>>> import listio
>>> mymap = listio.read_map('mymap.csv')
>>> list(mymap)
[['First column', 'second column', '3'], ['next;item,', 'foo', 'bar']]
The default CSV delimiter is ;
and lineterminator \n
. You can change this:
>>> listio.read_map('mymap.csv', delimiter=',', lineterminator='\r\n')
See tests/test_listio.py for more usage examples.
FAQs
Read/write lists and maps (two dimensional lists) from/to files.
We found that listio 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.