Skip to content

Commit

Permalink
v1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Code Lao committed Aug 24, 2023
1 parent a9887ab commit 820991c
Show file tree
Hide file tree
Showing 18 changed files with 378 additions and 198 deletions.
26 changes: 15 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
# 2.0.0
# 1.0.0
*2023-08-24*

### PocketTRC20 is now available on [PyPI](https://pypi.org/project/PocketTRC20/)
### Edited and improved code structure, added new functions, fixed some bugs.


# 0.10.0
*2023-06-13*

### NEW VERSION!
### New scanning algorithm. Now you can scan any transaction by entering only 1 command (guide in the README).
### New scanning method. Now you can scan any transaction by entering only 1 command (guide in the README).


# 1.2.1
# 0.6.0
*2023-04-16*

### Added internet connection check
### Edited some parameters


# 1.2.0
# 0.5.5
*2023-04-09*

### Edited
Expand All @@ -23,19 +29,17 @@
- Transaction scanning progress bar


# 1.1.0
# 0.5.0
*2023-02-08*

#### Bug fixing
### Added
- TRX transactions scanner
- Colored text in the terminal
[CryptoScans](https://www.mediafire.com/file/f63u4nhcz9g2ftx/CryptoScans_1.1.0.exe/file) is now available at MediaFire!

### Bug fixing

### [CryptoScans](https://www.mediafire.com/file/f63u4nhcz9g2ftx/CryptoScans_1.1.0.exe/file) is now available at MediaFire!


# 1.0.0
# 0.0.1
*2023-02-06*

### Hi
Binary file added Images/ptrc20-banner.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/ptrc20-details1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/ptrc20-details2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Images/ptrc20-info.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Lao

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
24 changes: 24 additions & 0 deletions PocketTRC20/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
# $
#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
# ____ ___ ____ _ _______ _____ $
# | _ \ / _ \ / ___| |/ / ____|_ _| $
# | |_) | | | | | | ' /| _| | | $
# | __/| |_| | |___| . \| |___ | | $
# |_| \___/ \____|_|\_\_____| |_| $
# _____ ____ ____ ____ ___ $
# |_ _| _ \ / ___|___ \ / _ \ $
# | | | |_) | | __) | | | | $
# | | | _ <| |___ / __/| |_| | $
# |_| |_| \_|\____|_____|\___/ $
# $
# $
# (..) $
#$$$$$$$ $$$$$$$$
#$$$$$$$$$$$$$$$$$

from .scanner import transaction, status, amount


NAME = 'PocketTRC20'
VERSION = '1.2.5'
40 changes: 40 additions & 0 deletions PocketTRC20/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
# $
#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
# ____ ___ ____ _ _______ _____ $
# | _ \ / _ \ / ___| |/ / ____|_ _| $
# | |_) | | | | | | ' /| _| | | $
# | __/| |_| | |___| . \| |___ | | $
# |_| \___/ \____|_|\_\_____| |_| $
# _____ ____ ____ ____ ___ $
# |_ _| _ \ / ___|___ \ / _ \ $
# | | | |_) | | __) | | | | $
# | | | _ <| |___ / __/| |_| | $
# |_| |_| \_|\____|_____|\___/ $
# $
# $
# (..) $
#$$$$$$$ $$$$$$$$
#$$$$$$$$$$$$$$$$$

import sys
import colorama
from .console import Scan


def entry_point():
colorama.init()
if '--hash' in sys.argv:
if len(sys.argv) == 3:
hash = sys.argv[2]
Scan().banner()
Scan().hash_scanner(hash)
else:
print('\033[31m! Hash wasn\'t entered\033[0m')
elif '--info' in sys.argv:
if len(sys.argv) == 2:
print('PocketTRC20\nby Lao\nLicensed under MIT\n\nOptions:\n--hash TRANSACTION_HASH scan transaction\n--info you\'re here')
else:
print('\033[31m! Unknown value: \033[0m' + sys.argv[2])
else:
print('\033[31m! Incorrect option\033[0m')
21 changes: 21 additions & 0 deletions PocketTRC20/config.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
# $
#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
# ____ ___ ____ _ _______ _____ $
# | _ \ / _ \ / ___| |/ / ____|_ _| $
# | |_) | | | | | | ' /| _| | | $
# | __/| |_| | |___| . \| |___ | | $
# |_| \___/ \____|_|\_\_____| |_| $
# _____ ____ ____ ____ ___ $
# |_ _| _ \ / ___|___ \ / _ \ $
# | | | |_) | | __) | | | | $
# | | | _ <| |___ / __/| |_| | $
# |_| |_| \_|\____|_____|\___/ $
# $
# $
# (..) $
#$$$$$$$ $$$$$$$$
#$$$$$$$$$$$$$$$$$

NAME = 'PocketTRC20'
VERSION = '1.0.0'
141 changes: 141 additions & 0 deletions PocketTRC20/console.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
import time
import requests
import urllib.request
import json
import sys
from .config import VERSION
from progress.bar import IncrementalBar


class Scan():
def __init__(self):
self.bar = IncrementalBar('Scanning transaction', max=7, suffix='%(percent)d%%')

def banner(self):
art = '''
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ $
$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
$ ____ ___ ____ _ _______ _____ $
$ | _ \ / _ \ / ___| |/ / ____|_ _| $
$ | |_) | | | | | | ' /| _| | | $
$ | __/| |_| | |___| . \| |___ | | $
$ |_| \___/ \____|_|\_\_____| |_| $
$ _____ ____ ____ ____ ___ $
$ |_ _| _ \ / ___|___ \ / _ \ $
$ | | | |_) | | __) | | | | $
$ | | | _ <| |___ / __/| |_| | $
$ |_| |_| \_|\____|_____|\___/ $
$ $
$ $
$ (..) $
$$$$$$$$ $$$$$$$$
$$$$$$$$$$$$$$$$$$
\033[1;34mby Lao\033[0m
'''
print(art + ' \033[34mv' + VERSION + '\033[0m')

def check_intConnection(self):
try:
urllib.request.urlopen('https://google.com', timeout=1)
return True
except:
return False

def hash_scanner(self, hash):
if self.check_intConnection() == True:
if not len(hash) == 64:
print('\033[31m! Incorrect hash entered\033[0m')
sys.exit(1)
else:
link = 'https://apilist.tronscan.org/api/transaction-info?hash=' + hash
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246'}
get_link = requests.get(link, headers=headers).text
time.sleep(0.1)
self.bar.next()
self.check_hash = json.loads(get_link)
time.sleep(0.1)
self.bar.next()
if self.check_hash == {} or self.check_hash == {"message":"some parameters are missing"} or self.check_hash == {"riskTransaction":False}:
time.sleep(0.1)
self.bar.finish()
print('\033[31m! Unable to get details of this transaction\033[0m')
sys.exit(1)
else:
token_check = self.check_hash["contractType"]
time.sleep(0.1)
self.bar.next()
if token_check == 31:
status = self.check_hash["contractRet"]
time.sleep(0.1)
self.bar.next()
if status == 'SUCCESS':
from_address = self.check_hash["tokenTransferInfo"]["from_address"]
time.sleep(0.1)
self.bar.next()
to_address = self.check_hash["tokenTransferInfo"]["to_address"]
time.sleep(0.1)
self.bar.next()
amount = self.check_hash["tokenTransferInfo"]["amount_str"]
time.sleep(0.1)
self.bar.next()
time.sleep(0.1)
self.bar.finish()
print(
'\033[32mTransaction details:\033[0m' +
'\nStatus: ' + status +
'\nFrom: ' + from_address +
'\nTo: ' + to_address +
'\nAmount: ' + str(amount)[0:-6] + ' USDT'
)
sys.exit(0)
else:
time.sleep(0.1)
self.bar.finish()
print(
'\033[32mTransaction details:\033[0m' +
'\nStatus: ' + status +
'\nAmount: 0 USDT'
)
sys.exit(0)
elif token_check == 1:
status = self.check_hash["contractRet"]
time.sleep(0.1)
self.bar.next()
if status == 'SUCCESS':
from_address = self.check_hash["contractData"]["owner_address"]
time.sleep(0.1)
self.bar.next()
to_address = self.check_hash["contractData"]["to_address"]
time.sleep(0.1)
self.bar.next()
amount = self.check_hash["contractData"]["amount"]
time.sleep(0.1)
self.bar.next()
time.sleep(0.1)
self.bar.finish()
print(
'\033[32mTransaction details:\033[0m' +
'\nStatus: ' + status +
'\nFrom: ' + from_address +
'\nTo: ' + to_address +
'\nAmount: ' + str(amount)[0:-6] + ' TRX'
)
sys.exit(0)
else:
time.sleep(0.1)
self.bar.finish()
print(
'\033[32mTransaction details:\033[0m' +
'\nStatus: ' + status +
'\nAmount: 0 TRX'
)
sys.exit(0)
else:
time.sleep(0.1)
self.bar.finish()
print('\033[31m! Unable to get details of this transaction\033[0m')
sys.exit(1)
else:
print('\033[31m! Check your internet connection\033[0m')
sys.exit(1)
72 changes: 72 additions & 0 deletions PocketTRC20/scanner.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import requests
import json
from .console import Scan


def transaction(hash):
if Scan().check_intConnection() == True:
if not len(hash) == 64:
raise ValueError('Incorrect hash entered.')
else:
details = {}
link = 'https://apilist.tronscan.org/api/transaction-info?hash=' + hash
headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.246'}
get_link = requests.get(link, headers=headers).text
check_hash = json.loads(get_link)
if check_hash == {} or check_hash == {"message":"some parameters are missing"} or check_hash == {"riskTransaction":False}:
raise KeyError('Unable to get details of this transaction.')
else:
token_check = check_hash["contractType"]
if token_check == 31:
status = check_hash["contractRet"]
if status == 'SUCCESS':
from_address = check_hash["tokenTransferInfo"]["from_address"]
to_address = check_hash["tokenTransferInfo"]["to_address"]
amount = check_hash["tokenTransferInfo"]["amount_str"]
details['Status'] = status
details['From'] = from_address
details['To'] = to_address
details['Amount'] = str(amount)[0:-6] + ' USDT'
return details
else:
details['Status'] = status
details['Amount'] = '0 USDT'
return details
elif token_check == 1:
status = check_hash["contractRet"]
if status == 'SUCCESS':
from_address = check_hash["contractData"]["owner_address"]
to_address = check_hash["contractData"]["to_address"]
amount = check_hash["contractData"]["amount"]
details['Status'] = status
details['From'] = from_address
details['To'] = to_address
details['Amount'] = str(amount)[0:-6] + ' TRX'
return details
else:
details['Status'] = status
details['Amount'] = '0 TRX'
return details
else:
raise KeyError('Unable to get details of this transaction.')
else:
raise ConnectionError('Check your internet connection')

def status(hash):
try:
details = transaction(hash)['Status']
return details
except Exception as e:
return e

def amount(hash, hide=False):
try:
details = transaction(hash)['Amount']
if hide == True:
return int(details[0:-5])
elif hide != True and hide != False:
raise ValueError('\'hide\' argument can be True or False only.')
else:
return details
except Exception as e:
return e
Loading

0 comments on commit 820991c

Please sign in to comment.