├── requirements.txt ├── README.md └── rug_check_v2.py /requirements.txt: -------------------------------------------------------------------------------- 1 | pyperclip 2 | termcolor 3 | requests 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Purpose 2 | 3 | This script will help you speed up the checks you need to do on Solana tokens before opening orders. 4 | 5 | Simply copy the token to your clipboard and this script will open the corresponding websites for the various checks. 6 | 7 | For example, if you follow a Telegram channel and click on a referral token, as soon as it is copied to your clipboard, the script will do the rest. This will save you several precious seconds! 8 | 9 | # Requirements 10 | 11 | I've developed and tested this python script for Windows. 12 | 13 | Python installation is required: https://www.python.org/downloads/windows/ 14 | 15 | Run the following commands after the installation: 16 | ``` 17 | git clone https://github.com/s1m0n3g/solana_rug_check.git 18 | cd solana_rug_check 19 | pip install -r requirements.txt 20 | python rug_check_v2.py 21 | ``` 22 | 23 | # How it appears 24 | ![screenshot](https://github.com/s1m0n3g/solana_rug_check/assets/41329914/10f33582-02ed-4099-ae8a-c0be54a19ebd) 25 | 26 | # Warnings 27 | 28 | Becareful: do not copy private info (such as private keys), or they will be passed to the websites selected. Anyone is responsible for an improper usage. 29 | 30 | # Donation & support 31 | SOL wallet: 32 | ``` 33 | HTnhTLttZxt91fqyzFNDkxUVuA4upgW1DRkKThXMNsiT 34 | ``` 35 | -------------------------------------------------------------------------------- /rug_check_v2.py: -------------------------------------------------------------------------------- 1 | import pyperclip 2 | import webbrowser 3 | from termcolor import colored 4 | import os 5 | import re 6 | import time 7 | import sys 8 | 9 | # Set error color for better visibility 10 | error_color = 'red' 11 | ok_color = 'green' 12 | 13 | # List to store sites 14 | sites = ["rugcheck", "solsniffer", "dexscreener", "birdeye"] 15 | 16 | # Set to store unique codes, not URLs 17 | opened_codes = set() 18 | 19 | # Dictionary to store last copied time for each code 20 | last_copied_time = {} 21 | 22 | # Variable to track clipboard error 23 | clipboard_error_shown = False 24 | 25 | # Add this variable to store the timestamp of the last warning 26 | last_warning_time = {} 27 | 28 | def setup_sites(): 29 | print("Select which sites to enable (Enter comma-separated numbers):") 30 | for i, site in enumerate(sites, 1): 31 | print(f"{i}. {site.capitalize()}") 32 | print(f"Q. Quit") 33 | 34 | choices = input("Enter numbers of sites to enable (e.g., 1,2,3,4) or 'Q' to quit: ") 35 | 36 | if choices.strip().upper() == 'Q': 37 | close_script() 38 | 39 | choices = choices.split(',') 40 | selected_sites = [] 41 | for choice in choices: 42 | if not choice.isdigit(): 43 | print(colored(f"Invalid choice '{choice}'. Please enter valid numbers.", error_color)) 44 | return [] 45 | 46 | choice = int(choice) 47 | if not 0 < choice <= len(sites): 48 | print(colored(f"Invalid choice '{choice}'. Please enter valid numbers.", error_color)) 49 | return [] 50 | 51 | selected_sites.append(sites[choice - 1]) 52 | 53 | return selected_sites 54 | 55 | def clear_clipboard(): 56 | pyperclip.copy('') 57 | 58 | def check_clipboard(): 59 | global opened_codes, clipboard_error_shown 60 | 61 | # Retry until clipboard is accessible 62 | while True: 63 | try: 64 | # Get the current clipboard content 65 | current_clipboard = pyperclip.paste() 66 | break # If we successfully got clipboard content, exit retry loop 67 | except pyperclip.PyperclipException as e: 68 | print(colored(f"Error accessing clipboard: {e}. Retrying in 5 seconds...", error_color)) 69 | time.sleep(5) # Wait for 5 seconds before retrying 70 | 71 | # Continue with rest of the logic as before 72 | # Validate clipboard content using a regular expression 73 | if not re.match(r"^[a-zA-Z0-9]+$", current_clipboard): 74 | if not clipboard_error_shown: 75 | print(colored("Waiting for a valid address...", error_color)) 76 | clipboard_error_shown = True 77 | return 78 | 79 | # Validate clipboard content length (40-50 characters) 80 | if not (40 <= len(current_clipboard) <= 50): 81 | if not clipboard_error_shown: 82 | print(colored(f"Error: clipboard content length is invalid. Expected 40-50 characters, got {len(current_clipboard)} characters.", error_color)) 83 | clipboard_error_shown = True 84 | return 85 | 86 | # Check if the code has been copied in the last few seconds 87 | current_time = time.time() 88 | if current_clipboard in last_copied_time and current_time - last_copied_time[current_clipboard] < 3: 89 | if current_clipboard not in last_warning_time or current_time - last_warning_time[current_clipboard] > 3: 90 | print(colored("Warning: This token has been opened within the few seconds.", 'yellow')) 91 | print(colored(f"Token: {current_clipboard}", 'yellow')) # Print the token in yellow 92 | last_warning_time[current_clipboard] = current_time # Update the timestamp of the last warning 93 | return 94 | 95 | # Reset clipboard error flag 96 | clipboard_error_shown = False 97 | 98 | # Update last copied time for the code 99 | last_copied_time[current_clipboard] = current_time 100 | 101 | opened_codes.add(current_clipboard) 102 | print(colored(f"Opening URLs for {current_clipboard}", ok_color)) 103 | 104 | try: 105 | # Send the code to the server (replace with your logic) 106 | send_to_server(current_clipboard) 107 | 108 | # Open URLs for enabled sites 109 | for site in selected_sites: 110 | open_url(site, current_clipboard) 111 | 112 | # Wait for few seconds before clearing the clipboard 113 | time.sleep(10) 114 | 115 | # Clear the clipboard after opening URLs 116 | clear_clipboard() 117 | except Exception as e: 118 | print(colored(f"Error: An error occurred while processing the code. Exception: {e}", error_color)) 119 | 120 | def send_to_server(code): 121 | # Place your code logic here to send the code to your server 122 | # For example: 123 | # print(f"Sending code to server: {code}") 124 | pass 125 | 126 | def open_url(site, code): 127 | # Opens the URL in a new browser tab 128 | if site == "rugcheck": 129 | webbrowser.open_new_tab("https://rugcheck.xyz/tokens/" + code) 130 | elif site == "solsniffer": 131 | webbrowser.open_new_tab("https://solsniffer.com/scanner/" + code) 132 | elif site == "dexscreener": 133 | webbrowser.open_new_tab("https://dexscreener.com/solana/" + code) 134 | elif site == "birdeye": 135 | webbrowser.open_new_tab("https://birdeye.so/token/" + code) 136 | 137 | def close_script(): 138 | print(colored("Closing the script...", 'yellow')) 139 | sys.exit() 140 | 141 | if __name__ == '__main__': 142 | try: 143 | # Ensure 'color' command works on your system (optional) 144 | os.system('color') 145 | except OSError: 146 | print(colored("Warning: 'color' command might not be supported on your system. Color highlighting might not work.", 'yellow')) 147 | 148 | while True: 149 | try: 150 | selected_sites = setup_sites() # Run setup to select sites to enable 151 | 152 | if not selected_sites: 153 | print(colored("No sites selected. Exiting.", error_color)) 154 | break 155 | 156 | print(colored("Press Ctrl+C to return to the menu.", 'yellow')) 157 | 158 | while True: 159 | # Check the clipboard 160 | check_clipboard() 161 | time.sleep(1) # Add a 1-second delay between clipboard checks 162 | 163 | except KeyboardInterrupt: 164 | print(colored("Returning to the menu...", 'yellow')) 165 | continue 166 | except EOFError: 167 | close_script() 168 | except SystemExit: 169 | break 170 | --------------------------------------------------------------------------------