Giter Club home page Giter Club logo

jsinfo-scan's Introduction

JSINFO-SCAN

前言

很早以前就想写一款对网站进行爬取,并且对网站中引入的JS进行信息搜集的一个工具,之前一直没有思路,因为对正则的熟悉程度没有到可以对js中的info进行匹配的地步,最近实验室的朋友写了一款工具:JSFinder,借用了他的思路,写了一款递归爬取域名(netloc/domain),以及递归从JS中获取信息的工具。

思路

写这个工具主要有这么几个点:

  • 如何爬取域名
  • 如何爬取JS
  • 如何从JS中获取信息

三个点的解决方案:

  • 正则匹配href属性中的链接
  • 正则匹配src属性中的链接,并判断链接是否为js。正则匹配<script></script>标签中的文本。
  • 使用LinkFinder的正则从JS中匹配敏感信息

优点

  • 实现递归爬取
  • 对JS中匹配到的info进行了处理,直观的展示出来

缺点

使用的是单线程,因为目前多线程还没学够,如果冒昧使用担心引起数据混乱的问题,也并不熟悉使用Lock()函数,怕使用的地方多了,多线程也变成了单线程。

Usage

python3 jsinfo.py -d jd.com --keyword jd --save jd.api.txt --savedomain jd.domain.txt
  • -d/-f

对单个域名或对域名文件进行扫描,文件需要一行一个域名。

  • --keyword

设置爬取关键字,会使用该关键字对域名进行匹配,必选项。

  • --savedomain

设置爬取出来的域名保存路径

  • --save

设置api保存路径

实例

  • 对京东进行爬取

只爬取jd.com,设置keyword为jd,joybuy,360:

enter image description here

  • 对百度进行爬取

enter image description here

Update

2019-7-5:重构代码,加入了爬行深度的设定,深度为1~2,默认为1,2即为深度爬取,同时增加了url的存储,即深度爬取爬取到的链接。

jsinfo-scan's People

Contributors

p1g3 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.