diff --git a/CHANGELOG.md b/CHANGELOG.md index 6147d63..18a97f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# 2.0.0 +*2023-06-13* + +### NEW VERSION! +### New scanning algorithm. Now you can scan any transaction by entering only 1 command (guide in the README). + + # 1.2.1 *2023-04-16* diff --git a/LICENSE b/LICENSE deleted file mode 100644 index c809e90..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 Code 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. diff --git a/README.md b/README.md index ea22788..1e4a834 100644 --- a/README.md +++ b/README.md @@ -1,39 +1,39 @@ +

+ Pocket TRC20 +

- + Console Tron Blockchain Scanner

-

- Crypto Scans -

* [More info](#more-info) * [Installation](#installation) -* [Usage](#usage) ## Screenshots

- - - - + +

## More info -Crypto Scans is a console based TRON blockchain explorer app -It is used for getting details of TRC20 transactions through your computer's terminal +Pocket TRC20 is a console based TRON blockchain scanner. + +It is used for getting details of TRC20 transactions just by entering 1 command into the terminal ## Installation +### MacOS/Linux ``` $ git clone https://github.com/codelao/CryptoScans.git -$ cd CryptoScans -$ pip3 install -r requirements.txt -$ cd code -$ python3 main.py +$ cd Pocket-TRC20 +``` +#### after that you can go to the information menu by using this command: +``` +$ bash ptrc20.sh --info +``` +#### or you can start scanning transactions by using only 1 command: +``` +$ bash ptrc20.sh --hash Trc20TransactionHash ``` - - -## Usage -After running Crypto Scans you can enter any TRC20 transaction hash in the terminal window and you will get the details of this transaction diff --git a/app_images/ptrc20-info.png b/app_images/ptrc20-info.png new file mode 100644 index 0000000..4890405 Binary files /dev/null and b/app_images/ptrc20-info.png differ diff --git a/app_images/ptrc20-scanning.png b/app_images/ptrc20-scanning.png new file mode 100644 index 0000000..164902c Binary files /dev/null and b/app_images/ptrc20-scanning.png differ diff --git a/code/main.py b/code/main.py deleted file mode 100755 index fb988c4..0000000 --- a/code/main.py +++ /dev/null @@ -1,185 +0,0 @@ -#_________ ___ -#__ ____/___________ _________ / /______ -#_ / __ ___/_ / / /__ __ \ __/ __ \ -#/ /___ _ / _ /_/ /__ /_/ / /_ / /_/ / -#\____/ /_/ _\__, / _ .___/___/ \____/ -# /____/ /_/ -#________ -# _____/___________ _______________ -#_____ \_ ___/ __ `/_ __ \_ ___/ -#____/ // /__ / /_/ /_ / / /(__ ) -#_____/ \___/ \__,_/ /_/ /_//____/ -# -# by Lao - - -import requests -import json -import time -import sys -import colorama -from urllib.request import urlopen -from pyfiglet import figlet_format -from termcolor import colored, cprint -from progress.bar import IncrementalBar - - -class App: - def __init__(self): - self.check_internet_connection() - self.main() - - def check_internet_connection(self): - try: - urlopen('https://google.com') - return True - except: - return False - - def main(self): - colorama.init() - cprint(figlet_format('Crypto Scans', 'speed'), 'green') - self.hash = input(colored('Enter TRC20 transaction hash\nMore info - /info\n', 'blue')) - if self.hash == '/info': - self.info = input(colored('Crypto Scans\n', 'green') + colored('by Lao\n', 'yellow') + colored('GitHub repository: https://github.com/codelao/CryptoScans\n', 'green') + colored('Go back?(yes/no)\n', 'blue')) - if self.info == 'yes': - self.main() - elif self.info == 'no': - sys.exit() - else: - print(colored('Unknown command', 'red')) - time.sleep(1) - self.main() - elif not len(self.hash) == 64: - self.wrong_hash = input(colored('Incorrect hash\nTry again?(yes/no)\n', 'red')) - if self.wrong_hash == 'yes': - self.main() - elif self.wrong_hash == 'no': - sys.exit() - else: - print(colored('Unknown command', 'red')) - time.sleep(1) - self.main() - else: - if self.check_internet_connection() == True: - self.bar = IncrementalBar(colored('Scanning transaction', 'blue'), max=7, suffix='%(percent)d%%') - self.link = 'https://apilist.tronscan.org/api/transaction-info?hash=' + self.hash - self.get_link = requests.get(self.link).text - self.bar.next() - self.check_hash = json.loads(self.get_link) - self.bar.next() - if self.check_hash == {} or self.check_hash == {"message":"some parameters are missing"}: - self.bar.finish() - self.hash_error = input(colored('Unable to get details of this transaction\nTry again?(yes/no)\n', 'red')) - if self.hash_error == 'yes': - self.main() - elif self.hash_error == 'no': - sys.exit() - else: - print(colored('Unknown command', 'red')) - time.sleep(1) - self.main() - else: - self.token_check = self.check_hash["contractType"] - self.bar.next() - if self.token_check == 31: - self.usdt_status = self.check_hash["contractRet"] - self.bar.next() - if self.usdt_status == 'SUCCESS': - self.from_address_usdt = self.check_hash["tokenTransferInfo"]["from_address"] - self.bar.next() - self.to_address_usdt = self.check_hash["tokenTransferInfo"]["to_address"] - self.bar.next() - self.amount_usdt = self.check_hash["tokenTransferInfo"]["amount_str"] - self.bar.next() - self.bar.finish() - self.result_usdt = input(colored('Transaction details:', 'blue') + - colored('\nStatus: ', 'yellow') + colored(self.usdt_status, 'green') + - colored('\nFrom: ', 'yellow') + colored(self.from_address_usdt, 'green') + - colored('\nTo: ', 'yellow') + colored(self.to_address_usdt, 'green') + - colored('\nAmount: ', 'yellow') + colored(str(self.amount_usdt)[0:-6] + ' USDT', 'green') + - colored('\nGo back?(yes/no)\n', 'blue') - ) - if self.result_usdt == 'yes': - self.main() - elif self.result_usdt == 'no': - sys.exit() - else: - print(colored('Unknown command', 'red')) - time.sleep(1) - self.main() - else: - self.bar.finish() - self.failed_usdt = input(colored('Transaction details:', 'blue') + - colored('\nStatus: ', 'yellow') + colored(self.usdt_status, 'red') + - colored('\nAmount: ', 'yellow') + colored('0 USDT', 'red') + - colored('\nGo back?(yes/no)\n', 'blue') - ) - if self.failed_usdt == 'yes': - self.main() - elif self.failed_usdt == 'no': - sys.exit() - else: - print(colored('Unknown command', 'red')) - time.sleep(1) - self.main() - elif self.token_check == 1: - self.trx_status = self.check_hash["contractRet"] - self.bar.next() - if self.trx_status == 'SUCCESS': - self.from_address_trx = self.check_hash["contractData"]["owner_address"] - self.bar.next() - self.to_address_trx = self.check_hash["contractData"]["to_address"] - self.bar.next() - self.amount_trx = self.check_hash["contractData"]["amount"] - self.bar.next() - self.bar.finish() - self.result_trx = input(colored('Transaction details:', 'blue') + - colored('\nStatus: ', 'yellow') + colored(self.trx_status, 'green') + - colored('\nFrom: ', 'yellow') + colored(self.from_address_trx, 'green') + - colored('\nTo: ', 'yellow') + colored(self.to_address_trx, 'green') + - colored('\nAmount: ', 'yellow') + colored(str(self.amount_trx)[0:-6] + ' TRX', 'green') + - colored('\nGo back?(yes/no)\n', 'blue') - ) - if self.result_trx == 'yes': - self.main() - elif self.result_trx == 'no': - sys.exit() - else: - print(colored('Unknown command', 'red')) - time.sleep(1) - self.main() - else: - self.bar.finish() - self.failed_trx = input(colored('Transaction details:', 'blue') + - colored('\nStatus: ', 'yellow') + colored(self.trx_status, 'red') + - colored('\nAmount: ', 'yellow') + colored('0 TRX', 'red') + - colored('\nGo back?(yes/no)\n', 'blue') - ) - if self.failed_trx == 'yes': - self.main() - elif self.failed_trx == 'no': - sys.exit() - else: - print(colored('Unknown command', 'red')) - time.sleep(1) - self.main() - else: - self.bar.finish() - self.token_error = input(colored('Unable to get details of this transaction\nTry again?(yes/no)\n', 'red')) - if self.token_error == 'yes': - self.main() - elif self.token_error == 'no': - sys.exit() - else: - print(colored('Unknown command', 'red')) - time.sleep(1) - self.main() - else: - print(colored('Check your internet connection', 'red')) - time.sleep(1) - sys.exit() - - -if __name__ == '__main__': - App() \ No newline at end of file diff --git a/logo.png b/logo.png deleted file mode 100644 index 22a7405..0000000 Binary files a/logo.png and /dev/null differ diff --git a/ptrc20.sh b/ptrc20.sh new file mode 100644 index 0000000..be33dd3 --- /dev/null +++ b/ptrc20.sh @@ -0,0 +1,56 @@ +#!/bin/bash + +if ! python3 --version; then + echo -e "\033[31m! App requires Python3 to be installed in your system first\033[0m" + exit 1 +else + if ! python3 scripts/check_internet.py; then + echo -e "\033[31m! Check your internet connection and try again\033[0m" + exit 1 + else + pip3 install requests colorama termcolor progress + clear + fi +fi + + +printf " _____ _____ ____ _ _____ _______\n" +printf "( | ( ) | \ | \ /\ ( . \ \_ _/\n" +printf "| - | | | | | /\_/ | |_/ | | ___/ | |\n" +printf "| ---- | | | | \/\ | ( | | | |\n" +printf "| | | | | \ | |-\ \ | |___ | |\n" +printf "|/ (_____) |____/ |_/ \/ (____/ (_)\n" +printf "\033[31m_______ ______ ____ _____ _____\033[0m\n" +printf "\033[31m\_ _/ | __/ | \ / \ ( )\033[0m\n" +printf "\033[31m | | | | | /\_/ \_) / | | |\033[0m\n" +printf "\033[31m | | | | | \/\ / / | | |\033[0m\n" +printf "\033[31m | | | | | \ / (_ | |\033[0m\n" +printf "\033[31m (_) |__/ |____/ (_____) (_____)\033[0m\n" +printf "\n" + + +info_arg=false +hash_arg=false +key=$1 +case $key in + --info) + info_arg=true + ;; + -H|--hash) + hash_arg=true + ;; +esac + +if $info_arg; then + echo -e "\033[1;91mPocket TRC20\033[0m" + echo -e "\033[1;90mv2.0.0\033[0m\n" + echo -e "--info Information menu \033[90m(current)\033[0m" + echo -e "-H, --hash Hash of the TRC20 transaction you want to scan\n" + echo -e "\033[1;93mFor example:\033[0m" + echo -e "\033[90mbash ptrc20.sh --hash 0b9cd40b4a9a36f99ba5c73527633cac6fc83a90563a3c5cf5d079dd2735f8ea\033[0m\n" +elif $hash_arg; then + python3 scripts/scanner.py $@ +else + echo -e "\033[31m! Wrong argument or none of them were entered\033[0m" + echo -e "Type \033[90mbash ptrc20.sh --info\033[0m for more information" +fi diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index 4b01042..0000000 --- a/requirements.txt +++ /dev/null @@ -1,5 +0,0 @@ -requests -colorama -pyfiglet -termcolor -progress \ No newline at end of file diff --git a/screenshot1.png b/screenshot1.png deleted file mode 100644 index 2146888..0000000 Binary files a/screenshot1.png and /dev/null differ diff --git a/screenshot2.png b/screenshot2.png deleted file mode 100644 index 54ce370..0000000 Binary files a/screenshot2.png and /dev/null differ diff --git a/screenshot3.png b/screenshot3.png deleted file mode 100644 index ab96304..0000000 Binary files a/screenshot3.png and /dev/null differ diff --git a/scripts/check_internet.py b/scripts/check_internet.py new file mode 100644 index 0000000..ffd1104 --- /dev/null +++ b/scripts/check_internet.py @@ -0,0 +1,9 @@ +from urllib.request import urlopen + + +def check_internet_connection(self): + try: + urlopen('https://google.com') + return True + except: + return False diff --git a/scripts/scanner.py b/scripts/scanner.py new file mode 100644 index 0000000..d3b7efc --- /dev/null +++ b/scripts/scanner.py @@ -0,0 +1,89 @@ +import requests +import json +import sys +import colorama +from termcolor import colored +from progress.bar import IncrementalBar + + +def hash_scanner(hash): + colorama.init() + if not len(hash) == 64: + print(colored('! Incorrect hash\n', 'red')) + sys.exit(1) + else: + bar = IncrementalBar('Scanning transaction', max=7, suffix='%(percent)d%%') + link = 'https://apilist.tronscan.org/api/transaction-info?hash=' + hash + get_link = requests.get(link).text + bar.next() + check_hash = json.loads(get_link) + bar.next() + if check_hash == {} or check_hash == {"message":"some parameters are missing"}: + bar.finish() + print(colored('! Unable to get details of this transaction\n', 'red')) + sys.exit(1) + else: + token_check = check_hash["contractType"] + bar.next() + if token_check == 31: + usdt_status = check_hash["contractRet"] + bar.next() + if usdt_status == 'SUCCESS': + from_address_usdt = check_hash["tokenTransferInfo"]["from_address"] + bar.next() + to_address_usdt = check_hash["tokenTransferInfo"]["to_address"] + bar.next() + amount_usdt = check_hash["tokenTransferInfo"]["amount_str"] + bar.next() + bar.finish() + print('Transaction details:' + + '\nStatus: ' + usdt_status + + '\nFrom: ' + from_address_usdt + + '\nTo: ' + to_address_usdt + + '\nAmount: ' + str(amount_usdt)[0:-6] + ' USDT\n' + ) + sys.exit(0) + else: + bar.finish() + print('Transaction details:' + + '\nStatus: ' + usdt_status + + '\nAmount: ' + '0 USDT\n' + ) + sys.exit(0) + elif token_check == 1: + trx_status = check_hash["contractRet"] + bar.next() + if trx_status == 'SUCCESS': + from_address_trx = check_hash["contractData"]["owner_address"] + bar.next() + to_address_trx = check_hash["contractData"]["to_address"] + bar.next() + amount_trx = check_hash["contractData"]["amount"] + bar.next() + bar.finish() + print('Transaction details:' + + '\nStatus: ' + trx_status + + '\nFrom: ' + from_address_trx + + '\nTo: ' + to_address_trx + + '\nAmount: ' + str(amount_trx)[0:-6] + ' TRX\n' + ) + sys.exit(0) + else: + bar.finish() + print('Transaction details:' + + '\nStatus: ' + trx_status + + '\nAmount: ' + '0 TRX\n' + ) + sys.exit(0) + else: + bar.finish() + print(colored('! Unable to get details of this transaction\n', 'red')) + sys.exit(1) + + +if __name__ == '__main__': + if len(sys.argv) == 3: + hash = sys.argv[2] + hash_scanner(hash) + else: + print(colored('! Hash wasn\'t entered\n'))