Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
This is standalone Python library based on libtonlibjson
, the functionality is similar to the ton-http-api
with the following restrictions:
Currently, the library works for Windows, Mac and Linux only on Intel CPUs:
pip3 install pytonlib
.In this repo Compose file is provided to deploy the example of service with pytonlib:
docker-compose -f docker-compose.jupyter.yaml build
docker-compose -f docker-compose.jupyter.yaml up -d
Jupyter Notebook will be available on port 3100 (http://localhost:3100).
We recommend to use IPython or Jupyter Notebook for prototyping because they allow to run async
code. An example of running async
code from script could be found in the end of this section.
import requests
import asyncio
from pathlib import Path
from pytonlib import TonlibClient
# downloading mainnet config
ton_config = requests.get('https://ton.org/global.config.json').json()
# create keystore directory for tonlib
keystore_dir = '/tmp/ton_keystore'
Path(keystore_dir).mkdir(parents=True, exist_ok=True)
# init TonlibClient
client = TonlibClient(ls_index=0, # choose LiteServer index to connect
config=ton_config,
keystore=keystore_dir)
# init tonlibjson
await client.init()
masterchain_info = await client.get_masterchain_info()
block_header = await client.get_block_header(**masterchain_info['last'])
shards = await client.get_shards(master_seqno=masterchain_info['last']['seqno'])
masterchain_info = await client.get_masterchain_info()
txs = await client.get_block_transactions(**masterchain_info['last'], count=10)
import requests
import asyncio
from pathlib import Path
from pytonlib import TonlibClient
async def main():
loop = asyncio.get_running_loop()
ton_config = requests.get('https://ton.org/global.config.json').json()
# create keystore directory for tonlib
keystore_dir = '/tmp/ton_keystore'
Path(keystore_dir).mkdir(parents=True, exist_ok=True)
# init TonlibClient
client = TonlibClient(ls_index=0, # choose LiteServer index to connect
config=ton_config,
keystore=keystore_dir,
loop=loop)
# init tonlibjson
await client.init()
# reading masterchain info
masterchain_info = await client.get_masterchain_info()
# closing session
await client.close()
if __name__ == '__main__':
asyncio.run(main())
To run tests in asyncio mode use the following command:
PYTHONPATH=./ pytest --asyncio-mode=strict tests/
FAQs
Python API for TON (Telegram Open Network)
We found that pytonlib demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 3 open source maintainers 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.