Parsing 10TB of Metadata, 26M Domain Names and 1.4M SSL Certs for $10 on AWS
blog.waleson.com
blog.waleson.com
observatory=> select count(distinct(sha256_fingerprint)) from certificates;
count
---------
1239943
observatory=> select count(distinct(target)) from scans;
count
---------
6483386
The scanner evaluates both certificate and ciphersuites and stores the results in DB, so we can run complex analysis [2,3]. There is also have a public client [4].I don't have a good way to provide direct access to the database yet, but if you're a researcher, ping me directly and we can figure something out.
[1] https://github.com/mozilla/tls-observatory
[2] https://twitter.com/jvehent/status/684127067005390848
I'm curious, how fast can one load data into Postgres? Is it possible to import data directly from CSV files?
But to answer your question: yes, postgres can load data from csv files: http://stackoverflow.com/questions/2987433/how-to-import-csv...
Yup! http://www.postgresql.org/docs/current/static/sql-copy.html
Hard to answer considering the number of variables impacting. pg_bulkload[0] quotes 18MB/s for parallel loading on DBT-2 (221s to load 4GB), and 12MB/s for the built-in COPY (with post-indexing, that is first import all the data then enable and build the indexes)
> Is it possible to import data directly from CSV files?
Yes, the COPY command[1] can probably be configured to support whatever your *SV format is. There's also pg_bulkload (which should be faster but works offline).
[0] http://ossc-db.github.io/pg_bulkload/index.html
[1] http://www.postgresql.org/docs/current/interactive/sql-copy....
https://all-certificates.s3.amazonaws.com/certificates.tar.g...
For exporting, pg_dump -F c greatly compresses the data so cost-wise you might be able to put on S3 and publish as a torrent.
- People request access and get an API key associated with a given load threshold, or don't use an API key and default to some low threshold
- Anything that SQL EXPLAIN says is over the threshold returns an error
- Successful requests' load costs and execution time (and possibly CPU, if that can be determined) count toward a usage rate limit
- An SQL parser implements the subset of SQL you deem safe and acceptable and forms a last-resort firewall
Obviously this is a complex solution; I'm curious what people's opinions are on whether this would overall be simpler or more difficult in the long run.
https://github.com/rapid7/sonar/wiki/Analyzing-Datasets
Project Sonar is one of the primary contributors to scans.io. The DAP utility is handy for parsing raw x509 certificates and generating JSON output.
In fact, that's exactly how Rust's standard library hashset is implemented since rust supports zero-sized types "in userland" (and unit `()` is a ZST):
pub struct HashSet<T, S = RandomState> {
map: HashMap<T, (), S>
}
http://doc.rust-lang.org/src/std/collections/hash/set.rs.htm...the 'sort' in 'sort | uniq' doesn't know you are going to be throwing away all the duplicate data.
If anyone is wondering, here is an implementation of the python approach i have lying around:
#!/usr/bin/env python2
import sys
from collections import defaultdict
c = defaultdict(int)
for line in sys.stdin:
c[line] += 1
top = sorted(c.items(), key=lambda (k,v): v)
for k, v in top:
print v, k, #!/usr/bin/env python2
import sys
from collections import Counter
for pair in Counter(sys.stdin).most_common():
print pair awk -e '!a[$0]++'
This also preserves the original input order, which is a nice property.Edit: Inbound might be unlimited free. The calculator did show me an inbound total a few times, but I can't reproduce it now.
Still, it does appear to reduce the price of getting data out of Amazon compared to using the internet.
https://aws.amazon.com/blogs/aws/aws-lowers-its-pricing-agai...
Edit: Actually I read the S3 parts again, it sounds like the CommonCrawl project pays the S3 costs, I think, since it looks like you're using their domain data?
> AWS is hosting the public data sets at no charge for the community
773733
0.77M of Alexa top 1M were not in my list.
$ cat alexa alexa myset | sort | uniq -u | wc -l
25842205
I mined 25,842,205 additional domain names.
(and yes.. now i see that you mentioned it in the article.. took me time to get there)
Feel free to grab a copy of our domain list. The "All domains with NS records" is the one you want. Has 191 million in it.
func main() {
ch := make(chan string)
for i := 0; i < MAX; i++ {
go fetchCert(ch)
}
scanner := bufio.NewScanner(os.Stdin)
for Scanner.Scan() {
line := scanner.Text()
ch <- line
}
}
All goroutines receive on the same channel! Instead a new goroutine should be launched for each net conn. One should be able to spawn 1000s (or 1Ms) of conns and avoid ulimits using buffered chans, waitgroups, timeouts, or counters...If you set MAX to 1000, you will have 1000 workers — and simultaneous connections.
The flaw is that when the last piece of work gets taken from the channel, the program will end, thus the last pieces of work that at the time are being processed, will get canceled. You could mitigate this by using a second channel, that the workers will access at the end of their work, thus ensuring that it will close only when the last worker finishes its work.
However, at a certain point, you may encounter bandwidth issues, timeouts, and the like due to local network congestion; that pattern has its uses there. I've tried writing a downloader that downloads every file it's given at once, and it went about as well as one would expect.
Inspired now to start a "go-saturate" library for measuring max net capacity...