Skip to content

Commit

Permalink
Merge pull request #92 from kpcyrd/current_exe
Browse files Browse the repository at this point in the history
Fix current_exe path issue on openbsd
  • Loading branch information
kpcyrd authored May 13, 2019
2 parents 0dcf5f4 + 231eba3 commit 056499f
Show file tree
Hide file tree
Showing 8 changed files with 1,259 additions and 2,588 deletions.
1,388 changes: 1,151 additions & 237 deletions Cargo.lock

Large diffs are not rendered by default.

15 changes: 4 additions & 11 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,8 @@ lto = false
travis-ci = { repository = "kpcyrd/sn0int" }

[workspace]
# rocket is broken and blocks the whole workspace, removing
#members = ["sn0int-registry/sn0int-common",
# "sn0int-registry"]
members = ["sn0int-registry/sn0int-common"]
exclude = ["sn0int-registry"]
members = ["sn0int-registry/sn0int-common",
"sn0int-registry"]

[dependencies]
sn0int-common = { version="0.6.0", path="sn0int-registry/sn0int-common" }
Expand All @@ -45,7 +42,7 @@ chrono = { version = "0.4", features = ["serde"] }
dirs = "1.0"
url = "1.7"
#chrootable-https = { path = "../chrootable-https" }
chrootable-https = "0.9"
chrootable-https = "0.10"
base64 = "0.10"
kuchiki = "0.7.2"
serde_urlencoded = "0.5"
Expand All @@ -54,7 +51,7 @@ serde_derive = "1.0"
serde_json = "1.0"
crossbeam-channel = "0.3"
ctrlc = "3.1"
opener = "0.3.0"
opener = "0.4"
separator = "0.4"
maplit = "1.0.1"
sloppy-rfc4880 = "0.1.2"
Expand Down Expand Up @@ -100,7 +97,3 @@ unveil = "0.2.0"
#boxxy = { path = "../boxxy-rs" }
boxxy = "0.10"
tempfile = "3.0"

#[patch.crates-io]
#rocket = { git = "https://github.com/SergioBenitez/Rocket.git", rev="c86f4312fb273c0380fb76a97bfb7fc227800542" }
#rocket_contrib = { git = "https://github.com/SergioBenitez/Rocket.git", rev="c86f4312fb273c0380fb76a97bfb7fc227800542" }
51 changes: 51 additions & 0 deletions modules/dev/dns-ns.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
-- Description: Add a domains NS records to scope
-- Version: 0.1.0
-- License: GPL-3.0
-- Source: domains

function strip_root_dot(name)
local m = regex_find("(.+)\\.$", name)
if last_err() then return end

if m == nil then
return name
else
return m[2]
end
end

function each(r)
local name = strip_root_dot(r)
local domain = psl_domain_from_dns_name(name)
if last_err() then return end

-- add domain
local domain_id = db_add('domain', {
value=domain,
})
if last_err() then return end
if domain_id == nil then return end

-- add subdomain
local subdomain_id = db_add('subdomain', {
domain_id=domain_id,
value=name,
})
if last_err() then return end
end

function run(arg)
local records = dns(arg['value'], {
record='NS',
})
if last_err() then return end
if records['error'] ~= nil then return end
records = records['answers']

for i=1, #records do
local r = records[i][2]
debug(r)
each(r['NS'])
if last_err() then return end
end
end
46 changes: 46 additions & 0 deletions modules/dev/tld-scan.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
-- Description: Search for the same domain base on all TLDs
-- Version: 0.1.0
-- License: GPL-3.0
-- Source: domains

function run(arg)
local m = regex_find('^([^\\.]+)\\.', arg['value'])
local base = m[2]

-- TODO: we need a way to cache this
-- TODO: .co.uk is missing
local url = 'https://data.iana.org/TLD/tlds-alpha-by-domain.txt'

local session = http_mksession()
local req = http_request(session, 'GET', url, {})
local resp = http_send(req)
if last_err() then return end
if resp['status'] ~= 200 then
return 'http error: ' .. resp['status']
end

local tlds = regex_find_all('([^\n]+)', resp['text'])

for i=1, #tlds do
local tld = tlds[i][1]:lower()

if not tld:match('^#') then
local domain = base .. '.' .. tld

debug(domain)
records = dns(domain, {
record='NS',
})
if last_err() then
clear_err()
else
if records['error'] == nil and records['answers'][1] then
debug(records)
db_add('domain', {
value=domain,
})
end
end
end
end
end
2 changes: 0 additions & 2 deletions sn0int-registry/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
.env
# this can be removed after -registry rejoins the workspace
/target/
Loading

0 comments on commit 056499f

Please sign in to comment.