serve html page rather than string of html
This commit is contained in:
		
							parent
							
								
									6d716993fd
								
							
						
					
					
						commit
						6aeedb8640
					
				| 
						 | 
					@ -0,0 +1,20 @@
 | 
				
			||||||
 | 
					<html>
 | 
				
			||||||
 | 
					    <head>
 | 
				
			||||||
 | 
					        <title>Random Ethereum Scanner</title>
 | 
				
			||||||
 | 
					    </head>
 | 
				
			||||||
 | 
					    <body>
 | 
				
			||||||
 | 
					        Addresses Scanned: <span id="scanned">0</span> <br>
 | 
				
			||||||
 | 
					        Balances Found: <span id="balances">0</span>
 | 
				
			||||||
 | 
					        <script>
 | 
				
			||||||
 | 
					            setInterval(()=>{
 | 
				
			||||||
 | 
					                fetch('/stats')
 | 
				
			||||||
 | 
					                    .then(response => response.json())
 | 
				
			||||||
 | 
					                    .then(response => {
 | 
				
			||||||
 | 
					                        document.getElementById('scanned').innerHTML = response["count"]
 | 
				
			||||||
 | 
					                        document.getElementById('balances').innerHTML = response["balancesFound"]
 | 
				
			||||||
 | 
					                    })
 | 
				
			||||||
 | 
					            }, 500)
 | 
				
			||||||
 | 
					            // document.getElementById('scanned').innerHTML(   )
 | 
				
			||||||
 | 
					        </script>
 | 
				
			||||||
 | 
					    </body>
 | 
				
			||||||
 | 
					</html>
 | 
				
			||||||
							
								
								
									
										20
									
								
								index.js
								
								
								
								
							
							
						
						
									
										20
									
								
								index.js
								
								
								
								
							| 
						 | 
					@ -5,10 +5,12 @@ const web3 = new Web3(new Web3.providers.HttpProvider(ethNetwork))
 | 
				
			||||||
const fs = require('fs')
 | 
					const fs = require('fs')
 | 
				
			||||||
const nodemailer = require("nodemailer")
 | 
					const nodemailer = require("nodemailer")
 | 
				
			||||||
const express = require("express")
 | 
					const express = require("express")
 | 
				
			||||||
 | 
					const path = require('path');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const app = express();
 | 
					const app = express();
 | 
				
			||||||
const port = process.env.PORT || "8000";
 | 
					const port = process.env.PORT || "8000";
 | 
				
			||||||
let count = 0
 | 
					let count = 0
 | 
				
			||||||
let found_count = 0
 | 
					let balancesFound = 0
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const transporter = nodemailer.createTransport({  
 | 
					const transporter = nodemailer.createTransport({  
 | 
				
			||||||
    service: 'gmail',
 | 
					    service: 'gmail',
 | 
				
			||||||
| 
						 | 
					@ -18,8 +20,8 @@ const transporter = nodemailer.createTransport({
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
})
 | 
					})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function main(_count, _found_count){
 | 
					function main(_count, _balancesFound){
 | 
				
			||||||
    found_count = _found_count
 | 
					    balancesFound = _balancesFound
 | 
				
			||||||
    count = _count
 | 
					    count = _count
 | 
				
			||||||
    let accounts = []    
 | 
					    let accounts = []    
 | 
				
			||||||
    let x = 0
 | 
					    let x = 0
 | 
				
			||||||
| 
						 | 
					@ -37,7 +39,7 @@ function search(accounts) {
 | 
				
			||||||
    ethscan.getEtherBalances(web3, addresses).then(balanceMap => {
 | 
					    ethscan.getEtherBalances(web3, addresses).then(balanceMap => {
 | 
				
			||||||
        for (const [key, value] of Object.entries(balanceMap)) {
 | 
					        for (const [key, value] of Object.entries(balanceMap)) {
 | 
				
			||||||
            if(BigInt(value) > 0) {
 | 
					            if(BigInt(value) > 0) {
 | 
				
			||||||
                found_count++
 | 
					                balancesFound++
 | 
				
			||||||
                message = key + ": " + accounts[addresses.indexOf(key)].privateKey + "\n"
 | 
					                message = key + ": " + accounts[addresses.indexOf(key)].privateKey + "\n"
 | 
				
			||||||
                writeToFile('/output/output.txt', message)
 | 
					                writeToFile('/output/output.txt', message)
 | 
				
			||||||
                transporter.sendMail({
 | 
					                transporter.sendMail({
 | 
				
			||||||
| 
						 | 
					@ -48,7 +50,7 @@ function search(accounts) {
 | 
				
			||||||
                }).catch(emailError)
 | 
					                }).catch(emailError)
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        main(count, found_count)
 | 
					        main(count, balancesFound)
 | 
				
			||||||
    }).catch(emailError)
 | 
					    }).catch(emailError)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -70,7 +72,11 @@ function writeToFile(filename, message) {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
app.get("/", (req, res) => {
 | 
					app.get("/", (req, res) => {
 | 
				
			||||||
    res.status(200).send("<html><head><title>Random Ethereum Scanner</title></head><body>Addresses tested: " + count + "<br>" + "Balances Found: " + found_count + "</body></html>");
 | 
					    res.sendFile(path.join(__dirname, '/index.html'))
 | 
				
			||||||
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					app.get("/stats", (req, res) => {
 | 
				
			||||||
 | 
					    res.status(200).send({ "count": count,"balancesFound": balancesFound });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 | 
					
 | 
				
			||||||
app.listen(port, () => {
 | 
					app.listen(port, () => {
 | 
				
			||||||
| 
						 | 
					@ -84,4 +90,4 @@ transporter.sendMail({
 | 
				
			||||||
    text: "Random Ethereum Scanner Started Successfully",
 | 
					    text: "Random Ethereum Scanner Started Successfully",
 | 
				
			||||||
}).catch((err)=>{writeToFile('/output/err.txt', err.toString())})
 | 
					}).catch((err)=>{writeToFile('/output/err.txt', err.toString())})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
main(count, found_count)
 | 
					main(count, balancesFound)
 | 
				
			||||||
| 
						 | 
					@ -13,6 +13,7 @@
 | 
				
			||||||
        "express": "^4.18.2",
 | 
					        "express": "^4.18.2",
 | 
				
			||||||
        "fs": "^0.0.1-security",
 | 
					        "fs": "^0.0.1-security",
 | 
				
			||||||
        "nodemailer": "^6.8.0",
 | 
					        "nodemailer": "^6.8.0",
 | 
				
			||||||
 | 
					        "path": "^0.12.7",
 | 
				
			||||||
        "web3": "^1.8.0"
 | 
					        "web3": "^1.8.0"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
| 
						 | 
					@ -2728,11 +2729,33 @@
 | 
				
			||||||
        "node": ">= 0.8"
 | 
					        "node": ">= 0.8"
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    "node_modules/path": {
 | 
				
			||||||
 | 
					      "version": "0.12.7",
 | 
				
			||||||
 | 
					      "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz",
 | 
				
			||||||
 | 
					      "integrity": "sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==",
 | 
				
			||||||
 | 
					      "dependencies": {
 | 
				
			||||||
 | 
					        "process": "^0.11.1",
 | 
				
			||||||
 | 
					        "util": "^0.10.3"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    "node_modules/path-to-regexp": {
 | 
					    "node_modules/path-to-regexp": {
 | 
				
			||||||
      "version": "0.1.7",
 | 
					      "version": "0.1.7",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
 | 
				
			||||||
      "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ=="
 | 
					      "integrity": "sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ=="
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    "node_modules/path/node_modules/inherits": {
 | 
				
			||||||
 | 
					      "version": "2.0.3",
 | 
				
			||||||
 | 
					      "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
 | 
				
			||||||
 | 
					      "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw=="
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					    "node_modules/path/node_modules/util": {
 | 
				
			||||||
 | 
					      "version": "0.10.4",
 | 
				
			||||||
 | 
					      "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz",
 | 
				
			||||||
 | 
					      "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==",
 | 
				
			||||||
 | 
					      "dependencies": {
 | 
				
			||||||
 | 
					        "inherits": "2.0.3"
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    "node_modules/pbkdf2": {
 | 
					    "node_modules/pbkdf2": {
 | 
				
			||||||
      "version": "3.1.2",
 | 
					      "version": "3.1.2",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz",
 | 
				
			||||||
| 
						 | 
					@ -6134,6 +6157,30 @@
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
 | 
				
			||||||
      "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
 | 
					      "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    "path": {
 | 
				
			||||||
 | 
					      "version": "0.12.7",
 | 
				
			||||||
 | 
					      "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz",
 | 
				
			||||||
 | 
					      "integrity": "sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==",
 | 
				
			||||||
 | 
					      "requires": {
 | 
				
			||||||
 | 
					        "process": "^0.11.1",
 | 
				
			||||||
 | 
					        "util": "^0.10.3"
 | 
				
			||||||
 | 
					      },
 | 
				
			||||||
 | 
					      "dependencies": {
 | 
				
			||||||
 | 
					        "inherits": {
 | 
				
			||||||
 | 
					          "version": "2.0.3",
 | 
				
			||||||
 | 
					          "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz",
 | 
				
			||||||
 | 
					          "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw=="
 | 
				
			||||||
 | 
					        },
 | 
				
			||||||
 | 
					        "util": {
 | 
				
			||||||
 | 
					          "version": "0.10.4",
 | 
				
			||||||
 | 
					          "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz",
 | 
				
			||||||
 | 
					          "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==",
 | 
				
			||||||
 | 
					          "requires": {
 | 
				
			||||||
 | 
					            "inherits": "2.0.3"
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    "path-to-regexp": {
 | 
					    "path-to-regexp": {
 | 
				
			||||||
      "version": "0.1.7",
 | 
					      "version": "0.1.7",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -13,6 +13,7 @@
 | 
				
			||||||
    "express": "^4.18.2",
 | 
					    "express": "^4.18.2",
 | 
				
			||||||
    "fs": "^0.0.1-security",
 | 
					    "fs": "^0.0.1-security",
 | 
				
			||||||
    "nodemailer": "^6.8.0",
 | 
					    "nodemailer": "^6.8.0",
 | 
				
			||||||
 | 
					    "path": "^0.12.7",
 | 
				
			||||||
    "web3": "^1.8.0"
 | 
					    "web3": "^1.8.0"
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue