Permalink
Browse files

Adding BitIodine.

  • Loading branch information...
1 parent 0c4ba4b commit 305680a9bd463b5b4a47fd46b28c127ebb581a67 Michele Spagnuolo committed Mar 28, 2014
Showing with 150,260 additions and 0 deletions.
  1. +10 −0 .gitignore
  2. +197 −0 deploy/blockparser/Makefile
  3. +138 −0 deploy/blockparser/callback.cpp
  4. +75 −0 deploy/blockparser/callback.h
  5. +247 −0 deploy/blockparser/cb/allAddresses.cpp
  6. +426 −0 deploy/blockparser/cb/allBalances.cpp
  7. +190 −0 deploy/blockparser/cb/closure.cpp
  8. +368 −0 deploy/blockparser/cb/dumpTX.cpp
  9. +106 −0 deploy/blockparser/cb/help.cpp
  10. +371 −0 deploy/blockparser/cb/lemon.cpp
  11. +153 −0 deploy/blockparser/cb/pristine.cpp
  12. +188 −0 deploy/blockparser/cb/rewards.cpp
  13. +102 −0 deploy/blockparser/cb/simpleStats.cpp
  14. +391 −0 deploy/blockparser/cb/sql.cpp
  15. +172 −0 deploy/blockparser/cb/taint.cpp
  16. +259 −0 deploy/blockparser/cb/transactions.cpp
  17. +23 −0 deploy/blockparser/common.h
  18. +53 −0 deploy/blockparser/contrib/closure-taint.sh
  19. +108 −0 deploy/blockparser/errlog.h
  20. +13 −0 deploy/blockparser/opcodes.cpp
  21. +135 −0 deploy/blockparser/opcodes.h
  22. +561 −0 deploy/blockparser/option.cpp
  23. +301 −0 deploy/blockparser/option.h
  24. +627 −0 deploy/blockparser/parser.cpp
  25. +17 −0 deploy/blockparser/rmd160.cpp
  26. +14 −0 deploy/blockparser/rmd160.h
  27. +16 −0 deploy/blockparser/sha256.cpp
  28. +14 −0 deploy/blockparser/sha256.h
  29. +734 −0 deploy/blockparser/util.cpp
  30. +308 −0 deploy/blockparser/util.h
  31. +2 −0 deploy/classifier/Lists/FBI.csv
  32. +1,210 −0 deploy/classifier/Lists/bitcoinotc.csv
  33. +4,770 −0 deploy/classifier/Lists/bitcointalk.csv
  34. +24,575 −0 deploy/classifier/Lists/casascius.csv
  35. +1 −0 deploy/classifier/Lists/donations.csv
  36. +1 −0 deploy/classifier/Lists/exchanges.csv
  37. +2 −0 deploy/classifier/Lists/freebies.csv
  38. +1 −0 deploy/classifier/Lists/gambling.csv
  39. +18 −0 deploy/classifier/Lists/incommon.py
  40. +1 −0 deploy/classifier/Lists/killers.csv
  41. +65 −0 deploy/classifier/Lists/malware.csv
  42. +1 −0 deploy/classifier/Lists/mining.csv
  43. +1 −0 deploy/classifier/Lists/scammers.csv
  44. +5,727 −0 deploy/classifier/Lists/shareholders.csv
  45. +6 −0 deploy/classifier/Lists/silkroad.csv
  46. +1 −0 deploy/classifier/Lists/stocks.csv
  47. +1 −0 deploy/classifier/Lists/wallets.csv
  48. +90 −0 deploy/classifier/bitcrypt.py
  49. +38 −0 deploy/classifier/bitcrypt_group.txt
  50. +1,075 −0 deploy/classifier/bitcrypt_known.txt
  51. +124 −0 deploy/classifier/bitcrypt_ransoms.txt
  52. +164 −0 deploy/classifier/bitcrypt_tx.txt
  53. +292 −0 deploy/classifier/classifier.py
  54. +89 −0 deploy/classifier/cryptolocker.py
  55. +1 −0 deploy/classifier/cryptolocker.txt
  56. +197 −0 deploy/classifier/cryptolocker_group.txt
  57. +70,887 −0 deploy/classifier/cryptolocker_known.txt
  58. +11,687 −0 deploy/classifier/cryptolocker_ransoms.txt
  59. +20,412 −0 deploy/classifier/cryptolocker_tx.txt
  60. +77 −0 deploy/classifier/features.py
  61. +127 −0 deploy/classifier/functions.py
  62. +70 −0 deploy/classifier/malware_addresses
  63. +1 −0 deploy/classifier/scrapers/base58.py
  64. +30 −0 deploy/classifier/scrapers/bitcoin-otc.py
  65. +1 −0 deploy/classifier/scrapers/bitcoin_functions.py
  66. +60 −0 deploy/classifier/scrapers/bitcointalk.py
  67. +34 −0 deploy/classifier/scrapers/bitfunder.py
  68. +36 −0 deploy/classifier/scrapers/casascius.py
  69. +51 −0 deploy/classifier/scrapers/justdice.py
  70. +89 −0 deploy/classifier/scrapers/mtgox.py
  71. +185 −0 deploy/clusterizer/clusterizer.py
  72. +139 −0 deploy/clusterizer/clusterizer_heur1.py
  73. +97 −0 deploy/common/base58.py
  74. +35 −0 deploy/common/bitcoin_functions.py
  75. +69 −0 deploy/common/queries.py
  76. +28 −0 deploy/common/sqlite_wrapper.py
  77. +45 −0 deploy/common/util.py
  78. +62 −0 deploy/exporter/blockchain_db_mapping.py
  79. +67 −0 deploy/exporter/exporter_clusters.py
  80. +58 −0 deploy/exporter/exporter_tx.py
  81. +72 −0 deploy/exporter/exporter_tx_from_cluster.py
  82. +61 −0 deploy/exporter/exporter_tx_in_cluster.py
  83. +41 −0 deploy/exporter/paths_from_addr_to_addr.py
  84. +39 −0 deploy/exporter/paths_from_addr_to_everything.py
  85. +75 −0 deploy/exporter/paths_from_cluster_to_addr.py
  86. +73 −0 deploy/exporter/paths_from_cluster_to_everything.py
  87. +43 −0 deploy/exporter/shortest_path_from_addr_to_addr.py
  88. +73 −0 deploy/exporter/shortest_paths_from_cluster_to_addr.py
  89. +78 −0 deploy/grapher/generate_lemon_transaction_graph.py
  90. +75 −0 deploy/grapher/generate_transaction_graph.py
  91. +101 −0 deploy/grapher/generate_users_graph.py
  92. +2 −0 deploy/lemon/Makefile
  93. +410 −0 deploy/lemon/bitiodine_server.cpp
View
@@ -0,0 +1,10 @@
+*.sqlite*
+__pycache__
+*.pyc
+*.dat
+*.dot
+*.o
+*.d
+.DS_Store
+*~
+deploy.sh
@@ -0,0 +1,197 @@
+
+SHELL=/bin/sh
+MAKEFLAGS=-j8
+
+CPLUS = g++
+
+INC = \
+ -I. \
+ -DNDEBUG \
+# -DLITECOIN \
+
+COPT = \
+ -g0 \
+ -O6 \
+ -m64 \
+ -Wall \
+ -msse3 \
+ -Wextra \
+ -Wformat \
+ -pedantic \
+ -std=c++0x \
+ -ffast-math \
+ -fno-check-new \
+ -funroll-loops \
+ -Wno-deprecated \
+ -fstrict-aliasing \
+ -Wformat-security \
+ -Wstrict-aliasing=2 \
+ -Wno-variadic-macros \
+ -fomit-frame-pointer \
+ -Wno-unused-variable \
+ -Wno-unused-parameter \
+
+LOPT = \
+ -s \
+
+LIBS = \
+ -lcrypto \
+ -ldl \
+
+all:parser
+
+.objs/callback.o : callback.cpp
+ @echo c++ -- callback.cpp
+ @mkdir -p .deps
+ @mkdir -p .objs
+ @${CPLUS} -MD ${INC} ${COPT} -c callback.cpp -o .objs/callback.o
+ @mv .objs/callback.d .deps
+
+.objs/allBalances.o : cb/allBalances.cpp
+ @echo c++ -- cb/allBalances.cpp
+ @mkdir -p .deps
+ @mkdir -p .objs
+ @${CPLUS} -MD ${INC} ${COPT} -c cb/allBalances.cpp -o .objs/allBalances.o
+ @mv .objs/allBalances.d .deps
+
+.objs/allAddresses.o : cb/allAddresses.cpp
+ @echo c++ -- cb/allAddresses.cpp
+ @mkdir -p .deps
+ @mkdir -p .objs
+ @${CPLUS} -MD ${INC} ${COPT} -c cb/allAddresses.cpp -o .objs/allAddresses.o
+ @mv .objs/allAddresses.d .deps
+
+.objs/closure.o : cb/closure.cpp
+ @echo c++ -- cb/closure.cpp
+ @mkdir -p .deps
+ @mkdir -p .objs
+ @${CPLUS} -MD ${INC} ${COPT} -c cb/closure.cpp -o .objs/closure.o
+ @mv .objs/closure.d .deps
+
+.objs/dumpTX.o : cb/dumpTX.cpp
+ @echo c++ -- cb/dumpTX.cpp
+ @mkdir -p .deps
+ @mkdir -p .objs
+ @${CPLUS} -MD ${INC} ${COPT} -c cb/dumpTX.cpp -o .objs/dumpTX.o
+ @mv .objs/dumpTX.d .deps
+
+.objs/pristine.o : cb/pristine.cpp
+ @echo c++ -- cb/pristine.cpp
+ @mkdir -p .deps
+ @mkdir -p .objs
+ @${CPLUS} -MD ${INC} ${COPT} -c cb/pristine.cpp -o .objs/pristine.o
+ @mv .objs/pristine.d .deps
+
+.objs/help.o : cb/help.cpp
+ @echo c++ -- cb/help.cpp
+ @mkdir -p .deps
+ @mkdir -p .objs
+ @${CPLUS} -MD ${INC} ${COPT} -c cb/help.cpp -o .objs/help.o
+ @mv .objs/help.d .deps
+
+.objs/rewards.o : cb/rewards.cpp
+ @echo c++ -- cb/rewards.cpp
+ @mkdir -p .deps
+ @mkdir -p .objs
+ @${CPLUS} -MD ${INC} ${COPT} -c cb/rewards.cpp -o .objs/rewards.o
+ @mv .objs/rewards.d .deps
+
+.objs/simpleStats.o : cb/simpleStats.cpp
+ @echo c++ -- cb/simpleStats.cpp
+ @mkdir -p .deps
+ @mkdir -p .objs
+ @${CPLUS} -MD ${INC} ${COPT} -c cb/simpleStats.cpp -o .objs/simpleStats.o
+ @mv .objs/simpleStats.d .deps
+
+.objs/sql.o : cb/sql.cpp
+ @echo c++ -- cb/sql.cpp
+ @mkdir -p .deps
+ @mkdir -p .objs
+ @${CPLUS} -MD ${INC} ${COPT} -c cb/sql.cpp -o .objs/sql.o
+ @mv .objs/sql.d .deps
+
+.objs/taint.o : cb/taint.cpp
+ @echo c++ -- cb/taint.cpp
+ @mkdir -p .deps
+ @mkdir -p .objs
+ @${CPLUS} -MD ${INC} ${COPT} -c cb/taint.cpp -o .objs/taint.o
+ @mv .objs/taint.d .deps
+
+.objs/transactions.o : cb/transactions.cpp
+ @echo c++ -- cb/transactions.cpp
+ @mkdir -p .deps
+ @mkdir -p .objs
+ @${CPLUS} -MD ${INC} ${COPT} -c cb/transactions.cpp -o .objs/transactions.o
+ @mv .objs/transactions.d .deps
+
+.objs/opcodes.o : opcodes.cpp
+ @echo c++ -- opcodes.cpp
+ @mkdir -p .deps
+ @mkdir -p .objs
+ @${CPLUS} -MD ${INC} ${COPT} -c opcodes.cpp -o .objs/opcodes.o
+ @mv .objs/opcodes.d .deps
+
+.objs/option.o : option.cpp
+ @echo c++ -- option.cpp
+ @mkdir -p .deps
+ @mkdir -p .objs
+ @${CPLUS} -MD ${INC} ${COPT} -c option.cpp -o .objs/option.o
+ @mv .objs/option.d .deps
+
+.objs/parser.o : parser.cpp
+ @echo c++ -- parser.cpp
+ @mkdir -p .deps
+ @mkdir -p .objs
+ @${CPLUS} -MD ${INC} ${COPT} -c parser.cpp -o .objs/parser.o
+ @mv .objs/parser.d .deps
+
+.objs/rmd160.o : rmd160.cpp
+ @echo c++ -- rmd160.cpp
+ @mkdir -p .deps
+ @mkdir -p .objs
+ @${CPLUS} -MD ${INC} ${COPT} -c rmd160.cpp -o .objs/rmd160.o
+ @mv .objs/rmd160.d .deps
+
+.objs/sha256.o : sha256.cpp
+ @echo c++ -- sha256.cpp
+ @mkdir -p .deps
+ @mkdir -p .objs
+ @${CPLUS} -MD ${INC} ${COPT} -c sha256.cpp -o .objs/sha256.o
+ @mv .objs/sha256.d .deps
+
+.objs/util.o : util.cpp
+ @echo c++ -- util.cpp
+ @mkdir -p .deps
+ @mkdir -p .objs
+ @${CPLUS} -MD ${INC} ${COPT} -c util.cpp -o .objs/util.o
+ @mv .objs/util.d .deps
+
+OBJS= \
+ .objs/allBalances.o \
+ .objs/allAddresses.o \
+ .objs/callback.o \
+ .objs/closure.o \
+ .objs/dumpTX.o \
+ .objs/help.o \
+ .objs/opcodes.o \
+ .objs/option.o \
+ .objs/parser.o \
+ .objs/pristine.o \
+ .objs/rewards.o \
+ .objs/rmd160.o \
+ .objs/sha256.o \
+ .objs/simpleStats.o \
+ .objs/sql.o \
+ .objs/taint.o \
+ .objs/transactions.o \
+ .objs/util.o \
+
+parser:${OBJS}
+ @echo lnk -- parser
+ @${CPLUS} ${LOPT} ${COPT} -o parser ${OBJS} ${LIBS}
+
+clean:
+ -rm -r -f *.o *.i .objs .deps *.d parser
+
+-include .deps/*
+
@@ -0,0 +1,138 @@
+
+#include <map>
+#include <util.h>
+#include <vector>
+#include <stdio.h>
+#include <string.h>
+#include <common.h>
+#include <errlog.h>
+#include <algorithm>
+#include <callback.h>
+static std::vector<Callback*> *callbacks;
+typedef std::map<uintptr_t, Callback*> CBMap;
+
+Callback::Callback()
+{
+ if(0==callbacks) callbacks = new std::vector<Callback*>;
+ callbacks->push_back(this);
+}
+
+Callback *Callback::find(
+ const char *name,
+ bool printList
+)
+{
+ CBMap found;
+ size_t sz = strlen(name);
+ auto e = callbacks->end();
+ auto i = callbacks->begin();
+ while(i!=e) {
+ Callback *c = *(i++);
+
+ std::vector<const char*> names;
+ names.push_back(c->name());
+ c->aliases(names);
+
+ auto e = names.end();
+ auto i = names.begin();
+ while(i!=e) {
+ const char *nm = *(i++);
+ size_t x = std::min(sz, strlen(nm));
+ if(0==strncasecmp(nm, name, x)) found[(uintptr_t)c] = c;
+ }
+ }
+
+ if(1==found.size() && !printList) {
+ return found.begin()->second;
+ } else if(0==found.size()) {
+ printf("\n");
+ warning("\"%s\": unknown command name\n", name);
+ } else {
+
+ printf("\n");
+
+ if(!printList) {
+ warning("\"%s\": ambiguous command name, could be any of:\n", name);
+ }
+
+ int count = 0;
+ auto e = found.end();
+ auto i = found.begin();
+ while(i!=e) {
+
+ std::vector<const char*> names;
+ Callback *c = (i++)->second;
+ c->aliases(names);
+
+ printf(
+ " %3d. %s%s",
+ ++count,
+ c->name(),
+ 0<names.size() ? " (aliases: " : ""
+ );
+
+ bool first = true;
+ auto e = names.end();
+ auto i = names.begin();
+ while(i!=e) {
+ const char *nm = *(i++);
+ printf(
+ "%s%s",
+ first ? "" : ", ",
+ nm
+ );
+ first = false;
+ }
+ printf(
+ "%s\n",
+ 0<names.size() ? ")" : ""
+ );
+ }
+ printf("\n");
+ }
+
+ if(printList || 0==strcmp(name, "help")) return 0;
+ printf("use:\n");
+ printf(" \"parser man\" for complete documentation of all commands.\n");
+ printf(" \"parser help\" for a short summary of available commands.\n\n");
+ exit(-1);
+}
+
+struct Cmp
+{
+ bool operator()(
+ const Callback *a,
+ const Callback *b
+ )
+ {
+ const char *an = a->name();
+ const char *bn = b->name();
+ int n = strcmp(an, bn);
+ return n<0;
+ }
+};
+
+void Callback::showAllHelps(
+ bool longHelp
+)
+{
+ auto e = callbacks->end();
+ auto i = callbacks->begin();
+ std::sort(i, e, Cmp());
+
+ while(i!=e) {
+ Callback *c = *(i++);
+ printf(" USAGE: parser %s ", c->name());
+ const optparse::OptionParser *parser = c->optionParser();
+ if(parser) {
+ printf(
+ "%s\n",
+ longHelp ?
+ parser->get_usage().c_str() :
+ parser->format_help().c_str()
+ );
+ }
+ }
+ printf("\n");
+}
+
Oops, something went wrong.

0 comments on commit 305680a

Please sign in to comment.