Esempio n. 1
0
  public static void runSimulation(int ON_CLOSE) throws Exception {

    // initializes the domain map
    UrlUtil.createDomainMap();

    Parser parser;

    // initialize the parser

    if (Arguments.hasType()) {
      if (Arguments.getType().equals("har")) {
        parser = new HarParser();
      } else if (Arguments.getType().equals("fourthparty")) {
        parser = new FourthPartyParser();
      } else if (Arguments.getType().equals("fourthpartydatafile")) {
        parser = new FourthPartyDataFileParser();
      } else {
        // fall back just provide class name
        Class parserClass = Class.forName(Arguments.getType());
        parser = (Parser) parserClass.newInstance();
      }
    } else {
      throw new Exception("no type specified");
    }

    String taintDepth = Arguments.getArg("taintDepth");
    try {
      Page.TAINT_DEPTH = Integer.parseInt(taintDepth);
    } catch (Exception e) {
      throw new Exception("invalid taint depth value");
    }

    List<Page> pages = parser.parse();
    Page.setPages(pages);

    // if prefuse
    GraphBuilder<Graph> graphbuilder = new PrefuseGraphBuilder();

    Graph prefuseGraph = graphbuilder.createGraph(pages);

    // if prefuse
    Indexer search = new PrefuseIndexer();
    search.buildIndex(prefuseGraph);

    // if prefuse
    // TODO: support more
    PrefuseVis p_vis = new PrefuseVis(prefuseGraph, "domain", "root", "redirect");

    p_vis.setSearchIndex(search);
    if (Arguments.hasNodeRanker()) {
      p_vis.setRanker(Arguments.getNodeRanker());
    }

    if (Arguments.hasNodeRanker()) {
      Arguments.getNodeRanker().run();
    }

    Visualization vis = p_vis;
    vis.startVisualization(ON_CLOSE);
  }
Esempio n. 2
0
 public static void main(String[] args) {
   try {
     Arguments.parse(args);
     runSimulation(JFrame.EXIT_ON_CLOSE);
   } catch (Exception e) {
     System.out.println(e.getMessage());
     e.printStackTrace();
     System.exit(-1);
   }
 }