-
Notifications
You must be signed in to change notification settings - Fork 1
Implementations
Michael - Blurpesec edited this page Jan 31, 2019
·
10 revisions
- Submit domain and output results when scan is complete
- Submit domain and download screenshot when scan is complete
- Submit domain and download DOM when scan is complete
- Search for domain and output most recent result
You can also see these in the repo here: https://github.com/hahnmichaelf/urlscan-api/tree/master/examples
const urlscan = require('urlscan-api')
// Submits a domain and then queries to get the result of the scan when it is complete.
const APIKEY = your_api_key_here
let domaintosubmit = 'https://mycrypto.com'
new urlscan().submit(APIKEY, domaintosubmit).then( function( submitoutput ) {
get_result(submitoutput.uuid)
} )
// console.logs the output JSON from urlscan.result( uuid)
get_result = (uuid) => {
var resultwait = setInterval(function() {
new urlscan().result(uuid).then( function( resultoutput ) {
if (resultoutput.statusCode != 404) {
console.log(JSON.stringify(resultoutput, null, 2))
clearInterval(resultwait)
}
} )
}, 10 * 1000) // re-check every 10 second
};
const urlscan = require('urlscan-api')
const config = require('../config.js')
const APIKEY = config.APIKEY
const filename = 'mycrypto.png'
// Submits a domain and then downloads the screenshot when the scan is complete.
let domaintosubmit = 'https://mycrypto.com'
new urlscan().submit(APIKEY, domaintosubmit).then( function( submitoutput ) {
get_result(submitoutput.uuid)
} )
get_result = (uuid) => {
var resultwait = setInterval(function() {
new urlscan().result(uuid).then( function( resultoutput ) {
if (resultoutput.statusCode != 404) {
downloadscreenshot(uuid, filename)
clearInterval(resultwait)
}
} )
}, 10 * 1000) // re-check every 10 second
};
downloadscreenshot = (uuid, filename) => {
new urlscan().downloadscreenshot(uuid, filename).then( function( downloadstatus ) {
console.log(JSON.stringify(downloadstatus, null, 2))
} )
}
const urlscan = require('urlscan-api')
const config = require('../config.js')
const APIKEY = config.APIKEY
const filename = 'mycrypto.txt'
// Submits a domain and then downloads the DOM when the scan is complete.
let domaintosubmit = 'https://mycrypto.com'
new urlscan().submit(APIKEY, domaintosubmit).then( function( submitoutput ) {
get_result(submitoutput.uuid)
} )
get_result = (uuid) => {
var resultwait = setInterval(function() {
new urlscan().result(uuid).then( function( resultoutput ) {
if (resultoutput.statusCode != 404) {
downloaddom(uuid, filename)
clearInterval(resultwait)
}
} )
}, 10 * 1000) // re-check every 10 second
};
downloaddom = (uuid, filename) => {
new urlscan().downloaddom(uuid, filename).then( function( downloadstatus ) {
console.log(JSON.stringify(downloadstatus, null, 2))
} )
}
const urlscan = require('urlscan-api')
// Submits a domain and then queries to get the result of the scan when it is complete.
const APIKEY = your_api_key_here
let domaintosearch = 'mycrypto.com'
new urlscan().searchdomain(domaintosearch).then( function( searchoutput ) {
get_result(searchoutput.results[0]._id)
} )
// console.logs the result associated with the most-recent task when searching for a domain.
get_result = (uuid) => {
new urlscan().result(uuid).then( function( resultoutput ) {
if (resultoutput.statusCode != 404) {
console.log(JSON.stringify(resultoutput, null, 2))
}
} )
};