-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Code Lao
committed
Aug 24, 2023
1 parent
a9887ab
commit 820991c
Showing
18 changed files
with
378 additions
and
198 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ | ||
# $ | ||
#$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ | ||
# ____ ___ ____ _ _______ _____ $ | ||
# | _ \ / _ \ / ___| |/ / ____|_ _| $ | ||
# | |_) | | | | | | ' /| _| | | $ | ||
# | __/| |_| | |___| . \| |___ | | $ | ||
# |_| \___/ \____|_|\_\_____| |_| $ | ||
# _____ ____ ____ ____ ___ $ | ||
# |_ _| _ \ / ___|___ \ / _ \ $ | ||
# | | | |_) | | __) | | | | $ | ||
# | | | _ <| |___ / __/| |_| | $ | ||
# |_| |_| \_|\____|_____|\___/ $ | ||
# $ | ||
# $ | ||
# (..) $ | ||
#$$$$$$$ $$$$$$$$ | ||
#$$$$$$$$$$$$$$$$$ | ||
|
||
NAME = 'PocketTRC20' | ||
VERSION = '1.0.0' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Oops, something went wrong.