├── .gitignore
├── docs
├── _build
│ ├── html
│ │ ├── .nojekyll
│ │ ├── objects.inv
│ │ ├── _static
│ │ │ ├── file.png
│ │ │ ├── plus.png
│ │ │ ├── minus.png
│ │ │ ├── pygments.css
│ │ │ ├── doctools.js
│ │ │ ├── underscore.js
│ │ │ ├── basic.css
│ │ │ ├── searchtools.js
│ │ │ └── underscore-1.3.1.js
│ │ ├── .buildinfo
│ │ ├── _sources
│ │ │ └── index.rst.txt
│ │ ├── search.html
│ │ ├── searchindex.js
│ │ ├── index.html
│ │ └── genindex.html
│ └── doctrees
│ │ ├── index.doctree
│ │ └── environment.pickle
├── api.rst
├── Makefile
├── index.rst
├── conf.py
└── examples
│ └── search-ip.rst
├── requirements.txt
├── onyphe
├── __init__.py
├── exception.py
└── client.py
├── setup.py
├── LICENSE
└── README.md
/.gitignore:
--------------------------------------------------------------------------------
1 | venv
--------------------------------------------------------------------------------
/docs/_build/html/.nojekyll:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/requirements.txt:
--------------------------------------------------------------------------------
1 | requests
2 |
--------------------------------------------------------------------------------
/onyphe/__init__.py:
--------------------------------------------------------------------------------
1 | from onyphe.client import Onyphe
2 | from onyphe.exception import APIError
--------------------------------------------------------------------------------
/docs/_build/html/objects.inv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onyphe/pyonyphe/HEAD/docs/_build/html/objects.inv
--------------------------------------------------------------------------------
/docs/_build/html/_static/file.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onyphe/pyonyphe/HEAD/docs/_build/html/_static/file.png
--------------------------------------------------------------------------------
/docs/_build/html/_static/plus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onyphe/pyonyphe/HEAD/docs/_build/html/_static/plus.png
--------------------------------------------------------------------------------
/docs/_build/doctrees/index.doctree:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onyphe/pyonyphe/HEAD/docs/_build/doctrees/index.doctree
--------------------------------------------------------------------------------
/docs/_build/html/_static/minus.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onyphe/pyonyphe/HEAD/docs/_build/html/_static/minus.png
--------------------------------------------------------------------------------
/docs/_build/doctrees/environment.pickle:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/onyphe/pyonyphe/HEAD/docs/_build/doctrees/environment.pickle
--------------------------------------------------------------------------------
/docs/api.rst:
--------------------------------------------------------------------------------
1 | .. _api:
2 |
3 | onyphe
4 | ======
5 | .. module:: onyphe
6 | .. autoclass:: Onyphe
7 | :inherited-members:
8 |
9 | Exceptions
10 | ~~~~~~~~~~
11 |
12 | .. autoexception:: onyphe.APIError
13 |
14 |
--------------------------------------------------------------------------------
/docs/_build/html/.buildinfo:
--------------------------------------------------------------------------------
1 | # Sphinx build info version 1
2 | # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
3 | config: fdaf10943dc6d5bd02e00cf5fecb02af
4 | tags: 645f666f9bcd5a90fca523b33c5a78b7
5 |
--------------------------------------------------------------------------------
/setup.py:
--------------------------------------------------------------------------------
1 | from setuptools import setup
2 |
3 | setup(
4 | name='pyonyphe',
5 | version='2.0',
6 | packages=['onyphe'],
7 | url='https://github.com/sebdraven/pyonyphe',
8 | license='MIT',
9 | author='Sebastien Larinier',
10 | author_email='slarinier@gmail.com',
11 | description=''
12 | )
13 |
--------------------------------------------------------------------------------
/onyphe/exception.py:
--------------------------------------------------------------------------------
1 |
2 | class APIError(Exception):
3 | """This exception gets raised whenever a non-200 status code was returned by the Onyphe API."""
4 | def __init__(self, value):
5 | self.value = value
6 |
7 | def __str__(self):
8 | return self.value
9 |
10 |
11 | class ParamError(Exception):
12 | def __init__(self, value):
13 | self.value = value
14 |
15 | def __str__(self):
16 | return self.value
17 |
--------------------------------------------------------------------------------
/docs/Makefile:
--------------------------------------------------------------------------------
1 | # Minimal makefile for Sphinx documentation
2 | #
3 |
4 | # You can set these variables from the command line.
5 | SPHINXOPTS =
6 | SPHINXBUILD = sphinx-build
7 | SPHINXPROJ = pyonyphe
8 | SOURCEDIR = .
9 | BUILDDIR = _build
10 |
11 | # Put it first so that "make" without argument is like "make help".
12 | help:
13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14 |
15 | .PHONY: help Makefile
16 |
17 | # Catch-all target: route all unknown targets to Sphinx using the new
18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19 | %: Makefile
20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
--------------------------------------------------------------------------------
/docs/index.rst:
--------------------------------------------------------------------------------
1 | .. pyonyphe documentation master file, created by
2 | sphinx-quickstart on Fri Dec 1 16:03:38 2017.
3 | You can adapt this file completely to your liking, but it should at least
4 | contain the root `toctree` directive.
5 |
6 | pyonyphe - official python libraby for Onyphe
7 | ===================================================================
8 | This is the official Python wrapper around both the Onyphe REST API.
9 |
10 | Introduction
11 | ~~~~~~~~~~~~
12 |
13 | tutorial
14 |
15 | Examples
16 | ~~~~~~~~
17 | .. toctree::
18 | :maxdepth: 2
19 |
20 | examples/search-ip.rst
21 | examples/query-summary
22 | examples/cert-stream
23 | examples/gifcreator
24 |
25 | API Reference
26 | ~~~~~~~~~~~~~
27 | .. toctree::
28 | :maxdepth: 2
29 |
30 | api
--------------------------------------------------------------------------------
/docs/_build/html/_sources/index.rst.txt:
--------------------------------------------------------------------------------
1 | .. pyonyphe documentation master file, created by
2 | sphinx-quickstart on Fri Dec 1 16:03:38 2017.
3 | You can adapt this file completely to your liking, but it should at least
4 | contain the root `toctree` directive.
5 |
6 | pyonyphe - official python libraby for Onyphe
7 | ===================================================================
8 | This is the official Python wrapper around both the Onyphe REST API.
9 |
10 | Introduction
11 | ~~~~~~~~~~~~
12 |
13 | tutorial
14 |
15 | Examples
16 | ~~~~~~~~
17 | .. toctree::
18 | :maxdepth: 2
19 |
20 | examples/search-ip.rst
21 | examples/query-summary
22 | examples/cert-stream
23 | examples/gifcreator
24 |
25 | API Reference
26 | ~~~~~~~~~~~~~
27 | .. toctree::
28 | :maxdepth: 2
29 |
30 | api
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Sebastien Larinier
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/docs/_build/html/search.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Search — pyonyphe 1.0 documentation
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
Search
44 |
45 |
46 |
47 | Please activate JavaScript to enable the search
48 | functionality.
49 |
50 |
51 |
52 | From here you can search these documents. Enter your search
53 | words into the box below and click "search". Note that the search
54 | function will automatically search for all of the words. Pages
55 | containing fewer words won't appear in the result list.
56 |
57 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
74 |
75 |
76 |
88 |
92 |
93 |
--------------------------------------------------------------------------------
/docs/_build/html/_static/pygments.css:
--------------------------------------------------------------------------------
1 | .highlight .hll { background-color: #ffffcc }
2 | .highlight { background: #eeffcc; }
3 | .highlight .c { color: #408090; font-style: italic } /* Comment */
4 | .highlight .err { border: 1px solid #FF0000 } /* Error */
5 | .highlight .k { color: #007020; font-weight: bold } /* Keyword */
6 | .highlight .o { color: #666666 } /* Operator */
7 | .highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */
8 | .highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */
9 | .highlight .cp { color: #007020 } /* Comment.Preproc */
10 | .highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */
11 | .highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */
12 | .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */
13 | .highlight .gd { color: #A00000 } /* Generic.Deleted */
14 | .highlight .ge { font-style: italic } /* Generic.Emph */
15 | .highlight .gr { color: #FF0000 } /* Generic.Error */
16 | .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */
17 | .highlight .gi { color: #00A000 } /* Generic.Inserted */
18 | .highlight .go { color: #333333 } /* Generic.Output */
19 | .highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */
20 | .highlight .gs { font-weight: bold } /* Generic.Strong */
21 | .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */
22 | .highlight .gt { color: #0044DD } /* Generic.Traceback */
23 | .highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */
24 | .highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */
25 | .highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */
26 | .highlight .kp { color: #007020 } /* Keyword.Pseudo */
27 | .highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */
28 | .highlight .kt { color: #902000 } /* Keyword.Type */
29 | .highlight .m { color: #208050 } /* Literal.Number */
30 | .highlight .s { color: #4070a0 } /* Literal.String */
31 | .highlight .na { color: #4070a0 } /* Name.Attribute */
32 | .highlight .nb { color: #007020 } /* Name.Builtin */
33 | .highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */
34 | .highlight .no { color: #60add5 } /* Name.Constant */
35 | .highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */
36 | .highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */
37 | .highlight .ne { color: #007020 } /* Name.Exception */
38 | .highlight .nf { color: #06287e } /* Name.Function */
39 | .highlight .nl { color: #002070; font-weight: bold } /* Name.Label */
40 | .highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */
41 | .highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */
42 | .highlight .nv { color: #bb60d5 } /* Name.Variable */
43 | .highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */
44 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */
45 | .highlight .mb { color: #208050 } /* Literal.Number.Bin */
46 | .highlight .mf { color: #208050 } /* Literal.Number.Float */
47 | .highlight .mh { color: #208050 } /* Literal.Number.Hex */
48 | .highlight .mi { color: #208050 } /* Literal.Number.Integer */
49 | .highlight .mo { color: #208050 } /* Literal.Number.Oct */
50 | .highlight .sa { color: #4070a0 } /* Literal.String.Affix */
51 | .highlight .sb { color: #4070a0 } /* Literal.String.Backtick */
52 | .highlight .sc { color: #4070a0 } /* Literal.String.Char */
53 | .highlight .dl { color: #4070a0 } /* Literal.String.Delimiter */
54 | .highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */
55 | .highlight .s2 { color: #4070a0 } /* Literal.String.Double */
56 | .highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */
57 | .highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */
58 | .highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */
59 | .highlight .sx { color: #c65d09 } /* Literal.String.Other */
60 | .highlight .sr { color: #235388 } /* Literal.String.Regex */
61 | .highlight .s1 { color: #4070a0 } /* Literal.String.Single */
62 | .highlight .ss { color: #517918 } /* Literal.String.Symbol */
63 | .highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */
64 | .highlight .fm { color: #06287e } /* Name.Function.Magic */
65 | .highlight .vc { color: #bb60d5 } /* Name.Variable.Class */
66 | .highlight .vg { color: #bb60d5 } /* Name.Variable.Global */
67 | .highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */
68 | .highlight .vm { color: #bb60d5 } /* Name.Variable.Magic */
69 | .highlight .il { color: #208050 } /* Literal.Number.Integer.Long */
--------------------------------------------------------------------------------
/docs/_build/html/searchindex.js:
--------------------------------------------------------------------------------
1 | Search.setIndex({docnames:["api","examples/search-ip","index"],envversion:{"sphinx.domains.c":1,"sphinx.domains.changeset":1,"sphinx.domains.citation":1,"sphinx.domains.cpp":1,"sphinx.domains.index":1,"sphinx.domains.javascript":1,"sphinx.domains.math":2,"sphinx.domains.python":1,"sphinx.domains.rst":1,"sphinx.domains.std":1,"sphinx.ext.viewcode":1,sphinx:56},filenames:["api.rst","examples/search-ip.rst","index.rst"],objects:{"":{onyphe:[0,0,0,"-"]},"onyphe.Onyphe":{add_alert:[0,3,1,""],alert_list:[0,3,1,""],bulk_summary_domain:[0,3,1,""],bulk_summary_hostname:[0,3,1,""],bulk_summary_ip:[0,3,1,""],del_alert:[0,3,1,""],search:[0,3,1,""],simple_ctl:[0,3,1,""],simple_datascan:[0,3,1,""],simple_datascan_datamd5:[0,3,1,""],simple_datashot:[0,3,1,""],simple_geoloc:[0,3,1,""],simple_inetnum:[0,3,1,""],simple_onionscan:[0,3,1,""],simple_onionshot:[0,3,1,""],simple_pastries:[0,3,1,""],simple_resolver:[0,3,1,""],simple_resolver_forward:[0,3,1,""],simple_resolver_reverse:[0,3,1,""],simple_sniffer:[0,3,1,""],simple_synscan:[0,3,1,""],simple_threatlist:[0,3,1,""],simple_topsite:[0,3,1,""],simple_vulnscan:[0,3,1,""],summary_domain:[0,3,1,""],summary_hostname:[0,3,1,""],summary_ip:[0,3,1,""],synscan:[0,3,1,""]},onyphe:{APIError:[0,1,1,""],Onyphe:[0,2,1,""]}},objnames:{"0":["py","module","Python module"],"1":["py","exception","Python exception"],"2":["py","class","Python class"],"3":["py","method","Python method"]},objtypes:{"0":"py:module","1":"py:exception","2":"py:class","3":"py:method"},terms:{"000z":1,"01t00":1,"01t05":1,"01t10":1,"01t12":1,"0mjevuy6":1,"0wuc90e1":1,"13t18":1,"14c5":1,"14t04":1,"14t17":1,"15t21":1,"16t17":1,"18t14":1,"1blu":1,"1eybgtdu":1,"20c":1,"20t03":1,"212d":1,"21t21":1,"23c5":1,"25t15":1,"26t14":1,"26t22":1,"26t23":1,"297b":1,"29ff":1,"2fff":1,"30t14":1,"30t18":1,"30t19":1,"30t20":1,"3c03":1,"3ce":1,"3dff":1,"40ff":1,"41c9":1,"441a":1,"4c28":1,"4eb4":1,"521c":1,"5a89":1,"5aff":1,"5c5b":1,"62ff":1,"67bd":1,"6jfxsw0":1,"71bb":1,"71ed":1,"73e8":1,"7cb6":1,"7fff":1,"846a":1,"8aff":1,"90ff":1,"91ff":1,"9dff":1,"class":0,"import":1,"public":1,"return":0,"try":1,IPs:0,The:0,a2cf:1,a7ff:1,about:0,abus:1,account:0,add:0,add_alert:0,address:0,alert:0,alert_list:0,all:0,amazon:1,amazonaw:1,apa:1,apach:0,apasfwl:1,api:[0,1],api_kei:[0,1],apierror:0,area61:1,argv:1,around:[0,2],as15169:1,as48707:1,asn:1,author:1,b00e:1,b5b0:1,better:1,bin:1,board:1,bot:1,both:2,bulk:0,bulk_summary_domain:0,bulk_summary_hostnam:0,bulk_summary_ip:0,bytemark:1,c4ff:1,c537:1,c8a9:1,caff:1,call:0,can:0,categori:[0,1],ce51:1,citi:1,code:0,com:1,comput:1,contain:0,count:1,countri:1,country_nam:1,cswkvpgt:1,ctl:0,d2ff:1,d4ff:1,d692:1,dacb:1,data:0,data_md5:0,datamd5:0,datascan:0,datashot:0,del:0,del_alert:0,delet:0,dict:0,dictionari:0,discordapp:1,dns:1,domain:[0,1],dump:1,e8b7:1,ec2:1,email:0,env:1,error:1,exampl:0,except:[1,2],exit:1,f03c:1,f07a:1,f15e:1,f41f:1,f73e:1,fals:1,fd9c:1,fdff:1,fe01:1,fe06:1,fe24:1,fe34:1,fe3c:1,fe57:1,fe58:1,fe61:1,fe63:1,fe6e:1,fe7e:1,fe80:1,fe85:1,fe89:1,fe92:1,fea1:1,feb8:1,fef2:1,fef4:1,ffcc:1,file:[0,1],forward:[0,1],from:0,geoloc:1,get:0,gist:1,github:1,githubusercont:1,given:0,googl:1,gt500:1,have:0,host:1,hostnam:[0,1],http:0,iad:1,id_alert:0,inetnum:[0,1],inform:[0,2],input:1,ipv4:0,ipv6:[0,1],json:1,kei:[0,1],kwarg:0,larini:1,latitud:1,len:1,linux:1,list:0,llc:1,locat:1,longitud:1,lwn:1,malwaredomain:1,mirror1:1,myip:1,name:0,net:1,netnam:1,non:0,obtain:0,onionscan:0,onionshot:0,onyph:1,onyphe_ip:1,org:1,organ:1,ovh:1,page:0,param:0,paramet:0,pastebin:1,pastri:[0,1],path:0,perform:1,port:[0,1],print:1,prod:1,product:0,python:1,queri:0,rais:0,raspbian:1,raw:1,rayzp25i:1,receiv:0,resolv:[0,1],rest:[0,2],result:[0,1],revers:[0,1],rqddrraz:1,rv1898:1,search:[0,2],sebastien:1,seen_dat:1,set:1,setup:1,simpl:0,simple_ctl:0,simple_datascan:0,simple_datascan_datamd5:0,simple_datashot:0,simple_geoloc:0,simple_inetnum:0,simple_onionscan:0,simple_onionshot:0,simple_pastri:0,simple_resolv:0,simple_resolver_forward:0,simple_resolver_revers:0,simple_sniff:0,simple_synscan:0,simple_threatlist:0,simple_topsit:0,simple_vulnscan:0,sniffer:0,sourc:[0,1],state:1,station:1,statu:[0,1],str:0,subnet:1,summari:0,summary_domain:0,summary_hostnam:0,summary_ip:[0,1],synscan:[0,1],sys:1,sysctl:1,t2uffrfw:1,than:1,thi:[0,2],threatlist:0,timestamp:1,tnbtevxi:1,took:1,topsit:0,total:1,tutori:2,type:[0,1],undisclos:1,unit:1,usag:1,user:1,usr:1,valid:1,valu:0,vctelecom:1,version:0,vulnscan:0,wdsrxk2y:1,whenev:0,window:0,wrapper:[0,2],www:[0,1],your:0,your_api_kei:1,zeustrack:1},titles:["onyphe","Search Information on an IP","pyonyphe - official python libraby for Onyphe"],titleterms:{api:2,exampl:2,except:0,inform:1,introduct:2,librabi:2,offici:2,onyph:[0,2],pyonyph:2,python:2,refer:2,search:1}})
--------------------------------------------------------------------------------
/docs/_build/html/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | pyonyphe - official python libraby for Onyphe — pyonyphe 1.0 documentation
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
pyonyphe - official python libraby for Onyphe
44 |
This is the official Python wrapper around both the Onyphe REST API.
45 |
46 |
Introduction
47 |
tutorial
48 |
49 |
57 |
58 |
API Reference
59 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
91 |
92 |
93 |
108 |
112 |
113 |
--------------------------------------------------------------------------------
/docs/conf.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | # -*- coding: utf-8 -*-
3 | #
4 | # pyonyphe documentation build configuration file, created by
5 | # sphinx-quickstart on Fri Dec 1 16:03:38 2017.
6 | #
7 | # This file is execfile()d with the current directory set to its
8 | # containing dir.
9 | #
10 | # Note that not all possible configuration values are present in this
11 | # autogenerated file.
12 | #
13 | # All configuration values have a default; values that are commented out
14 | # serve to show the default.
15 |
16 | # If extensions (or modules to document with autodoc) are in another directory,
17 | # add these directories to sys.path here. If the directory is relative to the
18 | # documentation root, use os.path.abspath to make it absolute, like shown here.
19 | #
20 | # import os
21 | # import sys
22 | # sys.path.insert(0, os.path.abspath('.'))
23 |
24 |
25 | # -- General configuration ------------------------------------------------
26 |
27 | # If your documentation needs a minimal Sphinx version, state it here.
28 | #
29 | # needs_sphinx = '1.0'
30 |
31 | # Add any Sphinx extension module names here, as strings. They can be
32 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
33 | # ones.
34 | extensions = ['sphinx.ext.autodoc',
35 | 'sphinx.ext.coverage',
36 | 'sphinx.ext.imgmath',
37 | 'sphinx.ext.viewcode',
38 | 'sphinx.ext.githubpages']
39 |
40 | # Add any paths that contain templates here, relative to this directory.
41 | templates_path = ['_templates']
42 |
43 | # The suffix(es) of source filenames.
44 | # You can specify multiple suffix as a list of string:
45 | #
46 | # source_suffix = ['.rst', '.md']
47 | source_suffix = '.rst'
48 |
49 | # The master toctree document.
50 | master_doc = 'index'
51 |
52 | # General information about the project.
53 | project = 'pyonyphe'
54 | copyright = '2017, Sebastien Larinier'
55 | author = 'Sebastien Larinier'
56 |
57 | # The version info for the project you're documenting, acts as replacement for
58 | # |version| and |release|, also used in various other places throughout the
59 | # built documents.
60 | #
61 | # The short X.Y version.
62 | version = '1.0'
63 | # The full version, including alpha/beta/rc tags.
64 | release = '1.0'
65 |
66 | # The language for content autogenerated by Sphinx. Refer to documentation
67 | # for a list of supported languages.
68 | #
69 | # This is also used if you do content translation via gettext catalogs.
70 | # Usually you set "language" from the command line for these cases.
71 | language = None
72 |
73 | # List of patterns, relative to source directory, that match files and
74 | # directories to ignore when looking for source files.
75 | # This patterns also effect to html_static_path and html_extra_path
76 | exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
77 |
78 | # The name of the Pygments (syntax highlighting) style to use.
79 | pygments_style = 'sphinx'
80 |
81 | # If true, `todo` and `todoList` produce output, else they produce nothing.
82 | todo_include_todos = False
83 |
84 |
85 | # -- Options for HTML output ----------------------------------------------
86 |
87 | # The theme to use for HTML and HTML Help pages. See the documentation for
88 | # a list of builtin themes.
89 | #
90 | html_theme = 'default'
91 |
92 | # Theme options are theme-specific and customize the look and feel of a theme
93 | # further. For a list of options available for each theme, see the
94 | # documentation.
95 | #
96 | # html_theme_options = {}
97 |
98 | # Add any paths that contain custom static files (such as style sheets) here,
99 | # relative to this directory. They are copied after the builtin static files,
100 | # so a file named "default.css" will overwrite the builtin "default.css".
101 | html_static_path = ['_static']
102 |
103 | # Custom sidebar templates, must be a dictionary that maps document names
104 | # to template names.
105 | #
106 | # This is required for the alabaster theme
107 | # refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
108 | html_sidebars = {
109 | '**': [
110 | 'relations.html', # needs 'show_related': True theme option to display
111 | 'searchbox.html',
112 | ]
113 | }
114 |
115 |
116 | # -- Options for HTMLHelp output ------------------------------------------
117 |
118 | # Output file base name for HTML help builder.
119 | htmlhelp_basename = 'pyonyphedoc'
120 |
121 |
122 | # -- Options for LaTeX output ---------------------------------------------
123 |
124 | latex_elements = {
125 | # The paper size ('letterpaper' or 'a4paper').
126 | #
127 | # 'papersize': 'letterpaper',
128 |
129 | # The font size ('10pt', '11pt' or '12pt').
130 | #
131 | # 'pointsize': '10pt',
132 |
133 | # Additional stuff for the LaTeX preamble.
134 | #
135 | # 'preamble': '',
136 |
137 | # Latex figure (float) alignment
138 | #
139 | # 'figure_align': 'htbp',
140 | }
141 |
142 | # Grouping the document tree into LaTeX files. List of tuples
143 | # (source start file, target name, title,
144 | # author, documentclass [howto, manual, or own class]).
145 | latex_documents = [
146 | (master_doc, 'pyonyphe.tex', 'pyonyphe Documentation',
147 | 'Sebastien Larinier', 'manual'),
148 | ]
149 |
150 |
151 | # -- Options for manual page output ---------------------------------------
152 |
153 | # One entry per manual page. List of tuples
154 | # (source start file, name, description, authors, manual section).
155 | man_pages = [
156 | (master_doc, 'pyonyphe', 'pyonyphe Documentation',
157 | [author], 1)
158 | ]
159 |
160 |
161 | # -- Options for Texinfo output -------------------------------------------
162 |
163 | # Grouping the document tree into Texinfo files. List of tuples
164 | # (source start file, target name, title, author,
165 | # dir menu entry, description, category)
166 | texinfo_documents = [
167 | (master_doc, 'pyonyphe', 'pyonyphe Documentation',
168 | author, 'pyonyphe', 'One line description of project.',
169 | 'Miscellaneous'),
170 | ]
171 |
172 |
173 |
174 |
--------------------------------------------------------------------------------
/docs/_build/html/genindex.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Index — pyonyphe 1.0 documentation
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
Index
41 |
42 |
43 |
A
44 | |
B
45 | |
D
46 | |
O
47 | |
S
48 |
49 |
50 |
A
51 |
63 |
64 |
B
65 |
77 |
78 |
D
79 |
85 |
86 |
O
87 |
97 |
98 |
S
99 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
169 |
170 |
171 |
183 |
187 |
188 |
--------------------------------------------------------------------------------
/docs/_build/html/_static/doctools.js:
--------------------------------------------------------------------------------
1 | /*
2 | * doctools.js
3 | * ~~~~~~~~~~~
4 | *
5 | * Sphinx JavaScript utilities for all documentation.
6 | *
7 | * :copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
8 | * :license: BSD, see LICENSE for details.
9 | *
10 | */
11 |
12 | /**
13 | * select a different prefix for underscore
14 | */
15 | $u = _.noConflict();
16 |
17 | /**
18 | * make the code below compatible with browsers without
19 | * an installed firebug like debugger
20 | if (!window.console || !console.firebug) {
21 | var names = ["log", "debug", "info", "warn", "error", "assert", "dir",
22 | "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace",
23 | "profile", "profileEnd"];
24 | window.console = {};
25 | for (var i = 0; i < names.length; ++i)
26 | window.console[names[i]] = function() {};
27 | }
28 | */
29 |
30 | /**
31 | * small helper function to urldecode strings
32 | */
33 | jQuery.urldecode = function(x) {
34 | return decodeURIComponent(x).replace(/\+/g, ' ');
35 | };
36 |
37 | /**
38 | * small helper function to urlencode strings
39 | */
40 | jQuery.urlencode = encodeURIComponent;
41 |
42 | /**
43 | * This function returns the parsed url parameters of the
44 | * current request. Multiple values per key are supported,
45 | * it will always return arrays of strings for the value parts.
46 | */
47 | jQuery.getQueryParameters = function(s) {
48 | if (typeof s === 'undefined')
49 | s = document.location.search;
50 | var parts = s.substr(s.indexOf('?') + 1).split('&');
51 | var result = {};
52 | for (var i = 0; i < parts.length; i++) {
53 | var tmp = parts[i].split('=', 2);
54 | var key = jQuery.urldecode(tmp[0]);
55 | var value = jQuery.urldecode(tmp[1]);
56 | if (key in result)
57 | result[key].push(value);
58 | else
59 | result[key] = [value];
60 | }
61 | return result;
62 | };
63 |
64 | /**
65 | * highlight a given string on a jquery object by wrapping it in
66 | * span elements with the given class name.
67 | */
68 | jQuery.fn.highlightText = function(text, className) {
69 | function highlight(node, addItems) {
70 | if (node.nodeType === 3) {
71 | var val = node.nodeValue;
72 | var pos = val.toLowerCase().indexOf(text);
73 | if (pos >= 0 &&
74 | !jQuery(node.parentNode).hasClass(className) &&
75 | !jQuery(node.parentNode).hasClass("nohighlight")) {
76 | var span;
77 | var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg");
78 | if (isInSVG) {
79 | span = document.createElementNS("http://www.w3.org/2000/svg", "tspan");
80 | } else {
81 | span = document.createElement("span");
82 | span.className = className;
83 | }
84 | span.appendChild(document.createTextNode(val.substr(pos, text.length)));
85 | node.parentNode.insertBefore(span, node.parentNode.insertBefore(
86 | document.createTextNode(val.substr(pos + text.length)),
87 | node.nextSibling));
88 | node.nodeValue = val.substr(0, pos);
89 | if (isInSVG) {
90 | var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect");
91 | var bbox = node.parentElement.getBBox();
92 | rect.x.baseVal.value = bbox.x;
93 | rect.y.baseVal.value = bbox.y;
94 | rect.width.baseVal.value = bbox.width;
95 | rect.height.baseVal.value = bbox.height;
96 | rect.setAttribute('class', className);
97 | addItems.push({
98 | "parent": node.parentNode,
99 | "target": rect});
100 | }
101 | }
102 | }
103 | else if (!jQuery(node).is("button, select, textarea")) {
104 | jQuery.each(node.childNodes, function() {
105 | highlight(this, addItems);
106 | });
107 | }
108 | }
109 | var addItems = [];
110 | var result = this.each(function() {
111 | highlight(this, addItems);
112 | });
113 | for (var i = 0; i < addItems.length; ++i) {
114 | jQuery(addItems[i].parent).before(addItems[i].target);
115 | }
116 | return result;
117 | };
118 |
119 | /*
120 | * backward compatibility for jQuery.browser
121 | * This will be supported until firefox bug is fixed.
122 | */
123 | if (!jQuery.browser) {
124 | jQuery.uaMatch = function(ua) {
125 | ua = ua.toLowerCase();
126 |
127 | var match = /(chrome)[ \/]([\w.]+)/.exec(ua) ||
128 | /(webkit)[ \/]([\w.]+)/.exec(ua) ||
129 | /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) ||
130 | /(msie) ([\w.]+)/.exec(ua) ||
131 | ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
132 | [];
133 |
134 | return {
135 | browser: match[ 1 ] || "",
136 | version: match[ 2 ] || "0"
137 | };
138 | };
139 | jQuery.browser = {};
140 | jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true;
141 | }
142 |
143 | /**
144 | * Small JavaScript module for the documentation.
145 | */
146 | var Documentation = {
147 |
148 | init : function() {
149 | this.fixFirefoxAnchorBug();
150 | this.highlightSearchWords();
151 | this.initIndexTable();
152 | if (DOCUMENTATION_OPTIONS.NAVIGATION_WITH_KEYS) {
153 | this.initOnKeyListeners();
154 | }
155 | },
156 |
157 | /**
158 | * i18n support
159 | */
160 | TRANSLATIONS : {},
161 | PLURAL_EXPR : function(n) { return n === 1 ? 0 : 1; },
162 | LOCALE : 'unknown',
163 |
164 | // gettext and ngettext don't access this so that the functions
165 | // can safely bound to a different name (_ = Documentation.gettext)
166 | gettext : function(string) {
167 | var translated = Documentation.TRANSLATIONS[string];
168 | if (typeof translated === 'undefined')
169 | return string;
170 | return (typeof translated === 'string') ? translated : translated[0];
171 | },
172 |
173 | ngettext : function(singular, plural, n) {
174 | var translated = Documentation.TRANSLATIONS[singular];
175 | if (typeof translated === 'undefined')
176 | return (n == 1) ? singular : plural;
177 | return translated[Documentation.PLURALEXPR(n)];
178 | },
179 |
180 | addTranslations : function(catalog) {
181 | for (var key in catalog.messages)
182 | this.TRANSLATIONS[key] = catalog.messages[key];
183 | this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')');
184 | this.LOCALE = catalog.locale;
185 | },
186 |
187 | /**
188 | * add context elements like header anchor links
189 | */
190 | addContextElements : function() {
191 | $('div[id] > :header:first').each(function() {
192 | $('').
193 | attr('href', '#' + this.id).
194 | attr('title', _('Permalink to this headline')).
195 | appendTo(this);
196 | });
197 | $('dt[id]').each(function() {
198 | $('').
199 | attr('href', '#' + this.id).
200 | attr('title', _('Permalink to this definition')).
201 | appendTo(this);
202 | });
203 | },
204 |
205 | /**
206 | * workaround a firefox stupidity
207 | * see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075
208 | */
209 | fixFirefoxAnchorBug : function() {
210 | if (document.location.hash && $.browser.mozilla)
211 | window.setTimeout(function() {
212 | document.location.href += '';
213 | }, 10);
214 | },
215 |
216 | /**
217 | * highlight the search words provided in the url in the text
218 | */
219 | highlightSearchWords : function() {
220 | var params = $.getQueryParameters();
221 | var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : [];
222 | if (terms.length) {
223 | var body = $('div.body');
224 | if (!body.length) {
225 | body = $('body');
226 | }
227 | window.setTimeout(function() {
228 | $.each(terms, function() {
229 | body.highlightText(this.toLowerCase(), 'highlighted');
230 | });
231 | }, 10);
232 | $('' + _('Hide Search Matches') + '
')
234 | .appendTo($('#searchbox'));
235 | }
236 | },
237 |
238 | /**
239 | * init the domain index toggle buttons
240 | */
241 | initIndexTable : function() {
242 | var togglers = $('img.toggler').click(function() {
243 | var src = $(this).attr('src');
244 | var idnum = $(this).attr('id').substr(7);
245 | $('tr.cg-' + idnum).toggle();
246 | if (src.substr(-9) === 'minus.png')
247 | $(this).attr('src', src.substr(0, src.length-9) + 'plus.png');
248 | else
249 | $(this).attr('src', src.substr(0, src.length-8) + 'minus.png');
250 | }).css('display', '');
251 | if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) {
252 | togglers.click();
253 | }
254 | },
255 |
256 | /**
257 | * helper function to hide the search marks again
258 | */
259 | hideSearchWords : function() {
260 | $('#searchbox .highlight-link').fadeOut(300);
261 | $('span.highlighted').removeClass('highlighted');
262 | },
263 |
264 | /**
265 | * make the url absolute
266 | */
267 | makeURL : function(relativeURL) {
268 | return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL;
269 | },
270 |
271 | /**
272 | * get the current relative url
273 | */
274 | getCurrentURL : function() {
275 | var path = document.location.pathname;
276 | var parts = path.split(/\//);
277 | $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() {
278 | if (this === '..')
279 | parts.pop();
280 | });
281 | var url = parts.join('/');
282 | return path.substring(url.lastIndexOf('/') + 1, path.length - 1);
283 | },
284 |
285 | initOnKeyListeners: function() {
286 | $(document).keydown(function(event) {
287 | var activeElementType = document.activeElement.tagName;
288 | // don't navigate when in search box or textarea
289 | if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT'
290 | && !event.altKey && !event.ctrlKey && !event.metaKey && !event.shiftKey) {
291 | switch (event.keyCode) {
292 | case 37: // left
293 | var prevHref = $('link[rel="prev"]').prop('href');
294 | if (prevHref) {
295 | window.location.href = prevHref;
296 | return false;
297 | }
298 | case 39: // right
299 | var nextHref = $('link[rel="next"]').prop('href');
300 | if (nextHref) {
301 | window.location.href = nextHref;
302 | return false;
303 | }
304 | }
305 | }
306 | });
307 | }
308 | };
309 |
310 | // quick alias for translations
311 | _ = Documentation.gettext;
312 |
313 | $(document).ready(function() {
314 | Documentation.init();
315 | });
316 |
--------------------------------------------------------------------------------
/docs/_build/html/_static/underscore.js:
--------------------------------------------------------------------------------
1 | // Underscore.js 1.3.1
2 | // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
3 | // Underscore is freely distributable under the MIT license.
4 | // Portions of Underscore are inspired or borrowed from Prototype,
5 | // Oliver Steele's Functional, and John Resig's Micro-Templating.
6 | // For all details and documentation:
7 | // http://documentcloud.github.com/underscore
8 | (function(){function q(a,c,d){if(a===c)return a!==0||1/a==1/c;if(a==null||c==null)return a===c;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return false;switch(e){case "[object String]":return a==String(c);case "[object Number]":return a!=+a?c!=+c:a==0?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source==
9 | c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if(typeof a!="object"||typeof c!="object")return false;for(var f=d.length;f--;)if(d[f]==a)return true;d.push(a);var f=0,g=true;if(e=="[object Array]"){if(f=a.length,g=f==c.length)for(;f--;)if(!(g=f in a==f in c&&q(a[f],c[f],d)))break}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return false;for(var h in a)if(b.has(a,h)&&(f++,!(g=b.has(c,h)&&q(a[h],c[h],d))))break;if(g){for(h in c)if(b.has(c,
10 | h)&&!f--)break;g=!f}}d.pop();return g}var r=this,G=r._,n={},k=Array.prototype,o=Object.prototype,i=k.slice,H=k.unshift,l=o.toString,I=o.hasOwnProperty,w=k.forEach,x=k.map,y=k.reduce,z=k.reduceRight,A=k.filter,B=k.every,C=k.some,p=k.indexOf,D=k.lastIndexOf,o=Array.isArray,J=Object.keys,s=Function.prototype.bind,b=function(a){return new m(a)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports)exports=module.exports=b;exports._=b}else r._=b;b.VERSION="1.3.1";var j=b.each=
11 | b.forEach=function(a,c,d){if(a!=null)if(w&&a.forEach===w)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e2;a==
12 | null&&(a=[]);if(y&&a.reduce===y)return e&&(c=b.bind(c,e)),f?a.reduce(c,d):a.reduce(c);j(a,function(a,b,i){f?d=c.call(e,d,a,b,i):(d=a,f=true)});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(z&&a.reduceRight===z)return e&&(c=b.bind(c,e)),f?a.reduceRight(c,d):a.reduceRight(c);var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect=
13 | function(a,c,b){var e;E(a,function(a,g,h){if(c.call(b,a,g,h))return e=a,true});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(A&&a.filter===A)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(B&&a.every===B)return a.every(c,b);j(a,function(a,g,h){if(!(e=
14 | e&&c.call(b,a,g,h)))return n});return e};var E=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(C&&a.some===C)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return n});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;return p&&a.indexOf===p?a.indexOf(c)!=-1:b=E(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck=
15 | function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;bd?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a,
17 | c,d){d||(d=b.identity);for(var e=0,f=a.length;e>1;d(a[g])=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1));return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e=0;d--)b=[a[d].apply(this,b)];return b[0]}};
24 | b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=J||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.defaults=function(a){j(i.call(arguments,
25 | 1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return q(a,b,[])};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=o||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)};
26 | b.isArguments=function(a){return l.call(a)=="[object Arguments]"};if(!b.isArguments(arguments))b.isArguments=function(a){return!(!a||!b.has(a,"callee"))};b.isFunction=function(a){return l.call(a)=="[object Function]"};b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)=="[object Date]"};
27 | b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a,b){return I.call(a,b)};b.noConflict=function(){r._=G;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e /g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};b.mixin=function(a){j(b.functions(a),
28 | function(c){K(c,b[c]=a[c])})};var L=0;b.uniqueId=function(a){var b=L++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var t=/.^/,u=function(a){return a.replace(/\\\\/g,"\\").replace(/\\'/g,"'")};b.template=function(a,c){var d=b.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.escape||t,function(a,b){return"',_.escape("+
29 | u(b)+"),'"}).replace(d.interpolate||t,function(a,b){return"',"+u(b)+",'"}).replace(d.evaluate||t,function(a,b){return"');"+u(b).replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj","_",d);return c?e(c,b):function(a){return e.call(this,a,b)}};b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var v=function(a,c){return c?b(a).chain():a},K=function(a,c){m.prototype[a]=
30 | function(){var a=i.call(arguments);H.call(a,this._wrapped);return v(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return v(d,this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return v(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain=
31 | true;return this};m.prototype.value=function(){return this._wrapped}}).call(this);
32 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # pyonyphe
2 |
3 | Client python for https://www.onyphe.io
4 |
5 | API documentations:
6 |
7 | # dependecies
8 |
9 | `pip install -r requirements.txt`
10 |
11 | # Installation
12 |
13 | `python3 setup.py install`
14 |
15 | # Documentation
16 |
17 | Documentation is available at https://pyonyphe.readthedocs.io
18 |
19 | ```python
20 | from onyphe import Onyphe
21 | on_client = Onyphe(apikey)
22 | on_client.ip('8.8.8.8')
23 | ```
24 |
25 | ```javascript
26 | {'count': 32,
27 | 'error': 0,
28 | 'myip': '176.169.140.4',
29 | 'results': [{'@category': 'geoloc',
30 | '@timestamp': '2017-12-01T12:32:23.000Z',
31 | '@type': 'ip',
32 | 'asn': 'AS15169',
33 | 'city': '',
34 | 'country': 'US',
35 | 'country_name': 'United States',
36 | 'geolocation': '37.7510,-97.8220',
37 | 'ip': '8.8.8.8',
38 | 'ipv6': 'false',
39 | 'latitude': '37.7510',
40 | 'longitude': '-97.8220',
41 | 'organization': 'Google LLC',
42 | 'subnet': '8.8.0.0/19'},
43 | {'@category': 'inetnum',
44 | '@timestamp': '1970-01-01T00:00:00.000Z',
45 | '@type': 'ip',
46 | 'country': 'US',
47 | 'information': ['Undisclosed'],
48 | 'netname': 'Undisclosed',
49 | 'seen_date': '1970-01-01',
50 | 'source': 'Undisclosed',
51 | 'subnet': 'Undisclosed'},
52 | {'@category': 'pastries',
53 | '@timestamp': '2017-12-01T10:56:10.000Z',
54 | '@type': 'pastebin',
55 | 'domain': ['discordapp.com', 'boards.net', '1blu.de', 'google.com'],
56 | 'hostname': ['station.boards.net',
57 | 'rv1898.1blu.de',
58 | 'google-public-dns-a.google.com'],
59 | 'ip': ['104.16.59.5',
60 | '104.16.20.142',
61 | '104.16.22.142',
62 | '104.16.23.142',
63 | '178.254.7.216',
64 | '104.16.19.142',
65 | '104.16.21.142',
66 | '104.16.58.5',
67 | '8.8.8.8'],
68 | 'key': 'CSWkvpgt',
69 | 'seen_date': '2017-12-01'},
70 | {'@category': 'pastries',
71 | '@timestamp': '2017-12-01T10:12:19.000Z',
72 | '@type': 'pastebin',
73 | 'domain': ['google.com'],
74 | 'hostname': ['google-public-dns-a.google.com',
75 | 'google-public-dns-b.google.com'],
76 | 'ip': ['8.8.8.8',
77 | '255.0.0.0',
78 | '192.168.160.1',
79 | '192.168.52.128',
80 | '8.8.4.4',
81 | '192.168.52.0',
82 | '255.255.255.0',
83 | '255.255.255.255',
84 | '192.168.52.255',
85 | '127.0.0.1',
86 | 'fe80::20c:29ff:fea1:d692'],
87 | 'key': 'rqDDrRaz',
88 | 'seen_date': '2017-12-01'},
89 | {'@category': 'pastries',
90 | '@timestamp': '2017-12-01T05:52:59.000Z',
91 | '@type': 'pastebin',
92 | 'domain': ['raspbian.org',
93 | 'google.com',
94 | 'githubusercontent.com',
95 | 'com.br',
96 | 'abuse.ch',
97 | 'hosts-file.net',
98 | 'malwaredomains.com',
99 | 'gt500.org',
100 | 'sysctl.org',
101 | 'amazonaws.com',
102 | 'ovh.net',
103 | 'co.uk',
104 | 'amazon.com'],
105 | 'hostname': ['zeustracker.abuse.ch',
106 | 'gist.githubusercontent.com',
107 | '5-153-225-231.no-reverse-dns-set.bytemark.co.uk',
108 | '210-29.amazon.com',
109 | 'raw.githubusercontent.com',
110 | 'mirror1.malwaredomains.com',
111 | 'bots.ovh.net',
112 | '206-80.amazon.com',
113 | 's3.amazonaws.com',
114 | 'ec2-107-22-171-143.compute-1.amazonaws.com',
115 | 'gt500.org',
116 | 'google-public-dns-a.google.com',
117 | 'www.raspbian.org',
118 | '186.216.161.195.user.vctelecom.com.br',
119 | '166-22.amazon.com',
120 | 'google-public-dns-b.google.com'],
121 | 'ip': ['213.186.34.12',
122 | '72.21.206.80',
123 | '8.8.4.4',
124 | '192.168.1.1',
125 | '151.101.194.49',
126 | '151.101.0.133',
127 | '151.101.2.49',
128 | '151.101.192.133',
129 | '8.8.8.8',
130 | '139.146.167.25',
131 | 'fe80::f15e:521c:71bb:4eb4',
132 | '151.101.128.133',
133 | '127.0.0.1',
134 | '151.101.64.133',
135 | '52.216.20.75',
136 | '207.171.166.22',
137 | '2001:41c9:1:3ce:0:0:1:10',
138 | '151.101.66.49',
139 | '74.63.222.170',
140 | '151.101.130.49',
141 | '186.216.161.195',
142 | '192.168.1.10',
143 | '72.21.210.29',
144 | '5.153.225.231',
145 | '107.22.171.143'],
146 | 'key': '1eyBGtdu',
147 | 'seen_date': '2017-12-01'},
148 | {'@category': 'pastries',
149 | '@timestamp': '2017-11-30T20:03:27.000Z',
150 | '@type': 'pastebin',
151 | 'domain': ['google.com'],
152 | 'hostname': ['google-public-dns-a.google.com'],
153 | 'ip': ['fe80::441a:a7ff:fef4:8540',
154 | 'fe80::42:fdff:fe89:f73e',
155 | 'fe80::c8a9:2fff:fe24:5054',
156 | 'fe80::14c5:5aff:fe58:212d',
157 | '192.168.1.254',
158 | '192.168.122.255',
159 | '255.255.255.0',
160 | 'fe80::42:90ff:feb8:b5b0',
161 | '172.27.0.1',
162 | 'fe80::e8b7:62ff:fe85:c537',
163 | '8.8.8.8',
164 | '172.21.0.1',
165 | 'fe80::4c28:c4ff:fe34:846a',
166 | '192.168.1.0',
167 | '192.168.122.1',
168 | 'fe80::42:caff:fe92:297b',
169 | '172.18.0.1',
170 | '172.20.0.1',
171 | 'fe80::42:d2ff:fef2:fd9c',
172 | 'fe80::f07a:3dff:fe06:a2cf',
173 | '172.22.0.1',
174 | '192.168.2.0',
175 | '192.168.1.111',
176 | '127.0.0.1',
177 | '172.30.0.1',
178 | '192.168.2.1',
179 | 'fe80::5055:7fff:fe6e:71ed',
180 | 'fe80::dacb:8aff:fe7e:b00e',
181 | '192.168.1.255',
182 | '172.19.0.1',
183 | 'fe80::7cb6:9dff:fe57:ffcc',
184 | 'fe80::f41f:d4ff:fe3c:5a89',
185 | '172.17.0.1',
186 | '172.26.0.1',
187 | 'fe80::42:40ff:fe01:23c5',
188 | '192.168.2.255'],
189 | 'key': 'wdSRXk2y',
190 | 'seen_date': '2017-11-30'},
191 | {'@category': 'pastries',
192 | '@timestamp': '2017-11-30T19:24:26.000Z',
193 | '@type': 'pastebin',
194 | 'domain': ['as48707.pl', 'google.com'],
195 | 'hostname': ['google-public-dns-a.google.com',
196 | 'ip-212-91-7-33.as48707.pl',
197 | 'ip-212-91-6-58.as48707.pl'],
198 | 'ip': ['8.8.8.8', '212.91.6.58', '212.91.7.33'],
199 | 'key': 'TNbTeVXY',
200 | 'seen_date': '2017-11-30'},
201 | {'@category': 'pastries',
202 | '@timestamp': '2017-11-30T19:08:48.000Z',
203 | '@type': 'pastebin',
204 | 'domain': ['google.com'],
205 | 'hostname': ['google-public-dns-a.google.com'],
206 | 'ip': ['8.8.8.8'],
207 | 'key': '0MjevuY6',
208 | 'seen_date': '2017-11-30'},
209 | {'@category': 'pastries',
210 | '@timestamp': '2017-11-30T18:58:23.000Z',
211 | '@type': 'pastebin',
212 | 'domain': ['google.com', 'github.com'],
213 | 'hostname': ['lb-192-30-253-113-iad.github.com',
214 | 'google-public-dns-a.google.com',
215 | 'lb-192-30-253-112-iad.github.com'],
216 | 'ip': ['8.8.8.8', '192.30.253.112', '192.30.253.113'],
217 | 'key': '0wUc90E1',
218 | 'seen_date': '2017-11-30'},
219 | {'@category': 'pastries',
220 | '@timestamp': '2017-11-30T14:46:07.000Z',
221 | '@type': 'pastebin',
222 | 'domain': ['lwn.net', 'google.com'],
223 | 'hostname': ['google-public-dns-a.google.com', 'prod.lwn.net'],
224 | 'ip': ['45.33.94.129',
225 | '255.255.255.255',
226 | '10.0.0.1',
227 | '2600:3c03:0:0:f03c:91ff:fe61:5c5b',
228 | '8.8.8.8',
229 | 'fe80::ce51:67bd:73e8:fe63'],
230 | 'key': '6jFXSW0s',
231 | 'seen_date': '2017-11-30'},
232 | {'@category': 'pastries',
233 | '@timestamp': '2017-11-30T14:29:21.000Z',
234 | '@type': 'pastebin',
235 | 'domain': ['google.com'],
236 | 'hostname': ['google-public-dns-a.google.com'],
237 | 'ip': ['8.8.8.8', '127.0.0.1'],
238 | 'key': 'T2UFfRFW',
239 | 'seen_date': '2017-11-30'},
240 | {'@category': 'pastries',
241 | '@timestamp': '2017-11-30T14:01:17.000Z',
242 | '@type': 'pastebin',
243 | 'domain': ['google.com'],
244 | 'hostname': ['google-public-dns-a.google.com'],
245 | 'ip': ['10.0.0.1', '255.255.255.255', '8.8.8.8'],
246 | 'key': 'RaYZP25y',
247 | 'seen_date': '2017-11-30'},
248 | {'@category': 'synscan',
249 | '@timestamp': '2017-11-26T23:47:45.000Z',
250 | '@type': 'port-53',
251 | 'asn': 'AS15169',
252 | 'country': 'US',
253 | 'ip': '8.8.8.8',
254 | 'location': '37.7510,-97.8220',
255 | 'organization': 'Google LLC',
256 | 'os': 'Linux',
257 | 'port': '53',
258 | 'seen_date': '2017-11-26'},
259 | {'@category': 'synscan',
260 | '@timestamp': '2017-11-26T22:47:46.000Z',
261 | '@type': 'port-53',
262 | 'asn': 'AS15169',
263 | 'country': 'US',
264 | 'ip': '8.8.8.8',
265 | 'location': '37.7510,-97.8220',
266 | 'organization': 'Google LLC',
267 | 'os': 'Linux',
268 | 'port': '53',
269 | 'seen_date': '2017-11-26'},
270 | {'@category': 'synscan',
271 | '@timestamp': '2017-11-26T22:47:42.000Z',
272 | '@type': 'port-53',
273 | 'asn': 'AS15169',
274 | 'country': 'US',
275 | 'ip': '8.8.8.8',
276 | 'location': '37.7510,-97.8220',
277 | 'organization': 'Google LLC',
278 | 'os': 'Linux',
279 | 'port': '53',
280 | 'seen_date': '2017-11-26'},
281 | {'@category': 'synscan',
282 | '@timestamp': '2017-11-26T22:47:31.000Z',
283 | '@type': 'port-53',
284 | 'asn': 'AS15169',
285 | 'country': 'US',
286 | 'ip': '8.8.8.8',
287 | 'location': '37.7510,-97.8220',
288 | 'organization': 'Google LLC',
289 | 'os': 'Linux',
290 | 'port': '53',
291 | 'seen_date': '2017-11-26'},
292 | {'@category': 'synscan',
293 | '@timestamp': '2017-11-26T22:47:31.000Z',
294 | '@type': 'port-53',
295 | 'asn': 'AS15169',
296 | 'country': 'US',
297 | 'ip': '8.8.8.8',
298 | 'location': '37.7510,-97.8220',
299 | 'organization': 'Google LLC',
300 | 'os': 'Linux',
301 | 'port': '53',
302 | 'seen_date': '2017-11-26'},
303 | {'@category': 'synscan',
304 | '@timestamp': '2017-11-26T22:47:26.000Z',
305 | '@type': 'port-53',
306 | 'asn': 'AS15169',
307 | 'country': 'US',
308 | 'ip': '8.8.8.8',
309 | 'location': '37.7510,-97.8220',
310 | 'organization': 'Google LLC',
311 | 'os': 'Linux',
312 | 'port': '53',
313 | 'seen_date': '2017-11-26'},
314 | {'@category': 'synscan',
315 | '@timestamp': '2017-11-26T22:47:24.000Z',
316 | '@type': 'port-53',
317 | 'asn': 'AS15169',
318 | 'country': 'US',
319 | 'ip': '8.8.8.8',
320 | 'location': '37.7510,-97.8220',
321 | 'organization': 'Google LLC',
322 | 'os': 'Linux',
323 | 'port': '53',
324 | 'seen_date': '2017-11-26'},
325 | {'@category': 'synscan',
326 | '@timestamp': '2017-11-26T22:47:20.000Z',
327 | '@type': 'port-53',
328 | 'asn': 'AS15169',
329 | 'country': 'US',
330 | 'ip': '8.8.8.8',
331 | 'location': '37.7510,-97.8220',
332 | 'organization': 'Google LLC',
333 | 'os': 'Linux',
334 | 'port': '53',
335 | 'seen_date': '2017-11-26'},
336 | {'@category': 'synscan',
337 | '@timestamp': '2017-11-26T22:47:20.000Z',
338 | '@type': 'port-53',
339 | 'asn': 'AS15169',
340 | 'country': 'US',
341 | 'ip': '8.8.8.8',
342 | 'location': '37.7510,-97.8220',
343 | 'organization': 'Google LLC',
344 | 'os': 'Linux',
345 | 'port': '53',
346 | 'seen_date': '2017-11-26'},
347 | {'@category': 'synscan',
348 | '@timestamp': '2017-11-26T22:47:17.000Z',
349 | '@type': 'port-53',
350 | 'asn': 'AS15169',
351 | 'country': 'US',
352 | 'ip': '8.8.8.8',
353 | 'location': '37.7510,-97.8220',
354 | 'organization': 'Google LLC',
355 | 'os': 'Linux',
356 | 'port': '53',
357 | 'seen_date': '2017-11-26'},
358 | {'@category': 'resolver',
359 | '@timestamp': '2017-11-26T14:37:09.000Z',
360 | '@type': 'forward',
361 | 'domain': 'better-than.tv',
362 | 'forward': 'area61.better-than.tv',
363 | 'ip': '8.8.8.8',
364 | 'ipv6': 0,
365 | 'seen_date': '2017-11-26'},
366 | {'@category': 'resolver',
367 | '@timestamp': '2017-11-25T15:19:42.000Z',
368 | '@type': 'reverse',
369 | 'domain': 'google.com',
370 | 'ip': '8.8.8.8',
371 | 'ipv6': 0,
372 | 'reverse': 'google-public-dns-a.google.com',
373 | 'seen_date': '2017-11-25'},
374 | {'@category': 'resolver',
375 | '@timestamp': '2017-11-21T21:38:10.000Z',
376 | '@type': 'reverse',
377 | 'domain': 'google.com',
378 | 'ip': '8.8.8.8',
379 | 'ipv6': 0,
380 | 'reverse': 'google-public-dns-a.google.com',
381 | 'seen_date': '2017-11-21'},
382 | {'@category': 'resolver',
383 | '@timestamp': '2017-11-20T03:34:43.000Z',
384 | '@type': 'forward',
385 | 'domain': 'apa.at',
386 | 'forward': 'apasfwl.apa.at',
387 | 'ip': '8.8.8.8',
388 | 'ipv6': 0,
389 | 'seen_date': '2017-11-20'},
390 | {'@category': 'resolver',
391 | '@timestamp': '2017-11-18T14:44:02.000Z',
392 | '@type': 'reverse',
393 | 'domain': 'google.com',
394 | 'ip': '8.8.8.8',
395 | 'ipv6': 0,
396 | 'reverse': 'google-public-dns-a.google.com',
397 | 'seen_date': '2017-11-18'},
398 | {'@category': 'resolver',
399 | '@timestamp': '2017-11-16T17:31:34.000Z',
400 | '@type': 'reverse',
401 | 'domain': 'google.com',
402 | 'ip': '8.8.8.8',
403 | 'ipv6': 0,
404 | 'reverse': 'google-public-dns-a.google.com',
405 | 'seen_date': '2017-11-16'},
406 | {'@category': 'resolver',
407 | '@timestamp': '2017-11-15T21:13:31.000Z',
408 | '@type': 'reverse',
409 | 'domain': 'google.com',
410 | 'ip': '8.8.8.8',
411 | 'ipv6': 0,
412 | 'reverse': 'google-public-dns-a.google.com',
413 | 'seen_date': '2017-11-15'},
414 | {'@category': 'resolver',
415 | '@timestamp': '2017-11-14T17:22:21.000Z',
416 | '@type': 'forward',
417 | 'domain': 'bot.nu',
418 | 'forward': 'bot.nu',
419 | 'ip': '8.8.8.8',
420 | 'ipv6': 0,
421 | 'seen_date': '2017-11-14'},
422 | {'@category': 'resolver',
423 | '@timestamp': '2017-11-14T04:58:21.000Z',
424 | '@type': 'reverse',
425 | 'domain': 'google.com',
426 | 'ip': '8.8.8.8',
427 | 'ipv6': 0,
428 | 'reverse': 'google-public-dns-a.google.com',
429 | 'seen_date': '2017-11-14'},
430 | {'@category': 'resolver',
431 | '@timestamp': '2017-11-13T18:45:27.000Z',
432 | '@type': 'reverse',
433 | 'domain': 'google.com',
434 | 'ip': '8.8.8.8',
435 | 'ipv6': 0,
436 | 'reverse': 'google-public-dns-a.google.com',
437 | 'seen_date': '2017-11-13'}],
438 | 'status': 'ok',
439 | 'took': '0.098',
440 | 'total': 1481}
441 | ```
442 |
--------------------------------------------------------------------------------
/docs/_build/html/_static/basic.css:
--------------------------------------------------------------------------------
1 | /*
2 | * basic.css
3 | * ~~~~~~~~~
4 | *
5 | * Sphinx stylesheet -- basic theme.
6 | *
7 | * :copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
8 | * :license: BSD, see LICENSE for details.
9 | *
10 | */
11 |
12 | /* -- main layout ----------------------------------------------------------- */
13 |
14 | div.clearer {
15 | clear: both;
16 | }
17 |
18 | /* -- relbar ---------------------------------------------------------------- */
19 |
20 | div.related {
21 | width: 100%;
22 | font-size: 90%;
23 | }
24 |
25 | div.related h3 {
26 | display: none;
27 | }
28 |
29 | div.related ul {
30 | margin: 0;
31 | padding: 0 0 0 10px;
32 | list-style: none;
33 | }
34 |
35 | div.related li {
36 | display: inline;
37 | }
38 |
39 | div.related li.right {
40 | float: right;
41 | margin-right: 5px;
42 | }
43 |
44 | /* -- sidebar --------------------------------------------------------------- */
45 |
46 | div.sphinxsidebarwrapper {
47 | padding: 10px 5px 0 10px;
48 | }
49 |
50 | div.sphinxsidebar {
51 | float: left;
52 | width: 230px;
53 | margin-left: -100%;
54 | font-size: 90%;
55 | word-wrap: break-word;
56 | overflow-wrap : break-word;
57 | }
58 |
59 | div.sphinxsidebar ul {
60 | list-style: none;
61 | }
62 |
63 | div.sphinxsidebar ul ul,
64 | div.sphinxsidebar ul.want-points {
65 | margin-left: 20px;
66 | list-style: square;
67 | }
68 |
69 | div.sphinxsidebar ul ul {
70 | margin-top: 0;
71 | margin-bottom: 0;
72 | }
73 |
74 | div.sphinxsidebar form {
75 | margin-top: 10px;
76 | }
77 |
78 | div.sphinxsidebar input {
79 | border: 1px solid #98dbcc;
80 | font-family: sans-serif;
81 | font-size: 1em;
82 | }
83 |
84 | div.sphinxsidebar #searchbox form.search {
85 | overflow: hidden;
86 | }
87 |
88 | div.sphinxsidebar #searchbox input[type="text"] {
89 | float: left;
90 | width: 80%;
91 | padding: 0.25em;
92 | box-sizing: border-box;
93 | }
94 |
95 | div.sphinxsidebar #searchbox input[type="submit"] {
96 | float: left;
97 | width: 20%;
98 | border-left: none;
99 | padding: 0.25em;
100 | box-sizing: border-box;
101 | }
102 |
103 |
104 | img {
105 | border: 0;
106 | max-width: 100%;
107 | }
108 |
109 | /* -- search page ----------------------------------------------------------- */
110 |
111 | ul.search {
112 | margin: 10px 0 0 20px;
113 | padding: 0;
114 | }
115 |
116 | ul.search li {
117 | padding: 5px 0 5px 20px;
118 | background-image: url(file.png);
119 | background-repeat: no-repeat;
120 | background-position: 0 7px;
121 | }
122 |
123 | ul.search li a {
124 | font-weight: bold;
125 | }
126 |
127 | ul.search li div.context {
128 | color: #888;
129 | margin: 2px 0 0 30px;
130 | text-align: left;
131 | }
132 |
133 | ul.keywordmatches li.goodmatch a {
134 | font-weight: bold;
135 | }
136 |
137 | /* -- index page ------------------------------------------------------------ */
138 |
139 | table.contentstable {
140 | width: 90%;
141 | margin-left: auto;
142 | margin-right: auto;
143 | }
144 |
145 | table.contentstable p.biglink {
146 | line-height: 150%;
147 | }
148 |
149 | a.biglink {
150 | font-size: 1.3em;
151 | }
152 |
153 | span.linkdescr {
154 | font-style: italic;
155 | padding-top: 5px;
156 | font-size: 90%;
157 | }
158 |
159 | /* -- general index --------------------------------------------------------- */
160 |
161 | table.indextable {
162 | width: 100%;
163 | }
164 |
165 | table.indextable td {
166 | text-align: left;
167 | vertical-align: top;
168 | }
169 |
170 | table.indextable ul {
171 | margin-top: 0;
172 | margin-bottom: 0;
173 | list-style-type: none;
174 | }
175 |
176 | table.indextable > tbody > tr > td > ul {
177 | padding-left: 0em;
178 | }
179 |
180 | table.indextable tr.pcap {
181 | height: 10px;
182 | }
183 |
184 | table.indextable tr.cap {
185 | margin-top: 10px;
186 | background-color: #f2f2f2;
187 | }
188 |
189 | img.toggler {
190 | margin-right: 3px;
191 | margin-top: 3px;
192 | cursor: pointer;
193 | }
194 |
195 | div.modindex-jumpbox {
196 | border-top: 1px solid #ddd;
197 | border-bottom: 1px solid #ddd;
198 | margin: 1em 0 1em 0;
199 | padding: 0.4em;
200 | }
201 |
202 | div.genindex-jumpbox {
203 | border-top: 1px solid #ddd;
204 | border-bottom: 1px solid #ddd;
205 | margin: 1em 0 1em 0;
206 | padding: 0.4em;
207 | }
208 |
209 | /* -- domain module index --------------------------------------------------- */
210 |
211 | table.modindextable td {
212 | padding: 2px;
213 | border-collapse: collapse;
214 | }
215 |
216 | /* -- general body styles --------------------------------------------------- */
217 |
218 | div.body {
219 | min-width: 450px;
220 | max-width: 800px;
221 | }
222 |
223 | div.body p, div.body dd, div.body li, div.body blockquote {
224 | -moz-hyphens: auto;
225 | -ms-hyphens: auto;
226 | -webkit-hyphens: auto;
227 | hyphens: auto;
228 | }
229 |
230 | a.headerlink {
231 | visibility: hidden;
232 | }
233 |
234 | a.brackets:before,
235 | span.brackets > a:before{
236 | content: "[";
237 | }
238 |
239 | a.brackets:after,
240 | span.brackets > a:after {
241 | content: "]";
242 | }
243 |
244 | h1:hover > a.headerlink,
245 | h2:hover > a.headerlink,
246 | h3:hover > a.headerlink,
247 | h4:hover > a.headerlink,
248 | h5:hover > a.headerlink,
249 | h6:hover > a.headerlink,
250 | dt:hover > a.headerlink,
251 | caption:hover > a.headerlink,
252 | p.caption:hover > a.headerlink,
253 | div.code-block-caption:hover > a.headerlink {
254 | visibility: visible;
255 | }
256 |
257 | div.body p.caption {
258 | text-align: inherit;
259 | }
260 |
261 | div.body td {
262 | text-align: left;
263 | }
264 |
265 | .first {
266 | margin-top: 0 !important;
267 | }
268 |
269 | p.rubric {
270 | margin-top: 30px;
271 | font-weight: bold;
272 | }
273 |
274 | img.align-left, .figure.align-left, object.align-left {
275 | clear: left;
276 | float: left;
277 | margin-right: 1em;
278 | }
279 |
280 | img.align-right, .figure.align-right, object.align-right {
281 | clear: right;
282 | float: right;
283 | margin-left: 1em;
284 | }
285 |
286 | img.align-center, .figure.align-center, object.align-center {
287 | display: block;
288 | margin-left: auto;
289 | margin-right: auto;
290 | }
291 |
292 | img.align-default, .figure.align-default {
293 | display: block;
294 | margin-left: auto;
295 | margin-right: auto;
296 | }
297 |
298 | .align-left {
299 | text-align: left;
300 | }
301 |
302 | .align-center {
303 | text-align: center;
304 | }
305 |
306 | .align-default {
307 | text-align: center;
308 | }
309 |
310 | .align-right {
311 | text-align: right;
312 | }
313 |
314 | /* -- sidebars -------------------------------------------------------------- */
315 |
316 | div.sidebar {
317 | margin: 0 0 0.5em 1em;
318 | border: 1px solid #ddb;
319 | padding: 7px 7px 0 7px;
320 | background-color: #ffe;
321 | width: 40%;
322 | float: right;
323 | }
324 |
325 | p.sidebar-title {
326 | font-weight: bold;
327 | }
328 |
329 | /* -- topics ---------------------------------------------------------------- */
330 |
331 | div.topic {
332 | border: 1px solid #ccc;
333 | padding: 7px 7px 0 7px;
334 | margin: 10px 0 10px 0;
335 | }
336 |
337 | p.topic-title {
338 | font-size: 1.1em;
339 | font-weight: bold;
340 | margin-top: 10px;
341 | }
342 |
343 | /* -- admonitions ----------------------------------------------------------- */
344 |
345 | div.admonition {
346 | margin-top: 10px;
347 | margin-bottom: 10px;
348 | padding: 7px;
349 | }
350 |
351 | div.admonition dt {
352 | font-weight: bold;
353 | }
354 |
355 | div.admonition dl {
356 | margin-bottom: 0;
357 | }
358 |
359 | p.admonition-title {
360 | margin: 0px 10px 5px 0px;
361 | font-weight: bold;
362 | }
363 |
364 | div.body p.centered {
365 | text-align: center;
366 | margin-top: 25px;
367 | }
368 |
369 | /* -- tables ---------------------------------------------------------------- */
370 |
371 | table.docutils {
372 | border: 0;
373 | border-collapse: collapse;
374 | }
375 |
376 | table.align-center {
377 | margin-left: auto;
378 | margin-right: auto;
379 | }
380 |
381 | table.align-default {
382 | margin-left: auto;
383 | margin-right: auto;
384 | }
385 |
386 | table caption span.caption-number {
387 | font-style: italic;
388 | }
389 |
390 | table caption span.caption-text {
391 | }
392 |
393 | table.docutils td, table.docutils th {
394 | padding: 1px 8px 1px 5px;
395 | border-top: 0;
396 | border-left: 0;
397 | border-right: 0;
398 | border-bottom: 1px solid #aaa;
399 | }
400 |
401 | table.footnote td, table.footnote th {
402 | border: 0 !important;
403 | }
404 |
405 | th {
406 | text-align: left;
407 | padding-right: 5px;
408 | }
409 |
410 | table.citation {
411 | border-left: solid 1px gray;
412 | margin-left: 1px;
413 | }
414 |
415 | table.citation td {
416 | border-bottom: none;
417 | }
418 |
419 | th > p:first-child,
420 | td > p:first-child {
421 | margin-top: 0px;
422 | }
423 |
424 | th > p:last-child,
425 | td > p:last-child {
426 | margin-bottom: 0px;
427 | }
428 |
429 | /* -- figures --------------------------------------------------------------- */
430 |
431 | div.figure {
432 | margin: 0.5em;
433 | padding: 0.5em;
434 | }
435 |
436 | div.figure p.caption {
437 | padding: 0.3em;
438 | }
439 |
440 | div.figure p.caption span.caption-number {
441 | font-style: italic;
442 | }
443 |
444 | div.figure p.caption span.caption-text {
445 | }
446 |
447 | /* -- field list styles ----------------------------------------------------- */
448 |
449 | table.field-list td, table.field-list th {
450 | border: 0 !important;
451 | }
452 |
453 | .field-list ul {
454 | margin: 0;
455 | padding-left: 1em;
456 | }
457 |
458 | .field-list p {
459 | margin: 0;
460 | }
461 |
462 | .field-name {
463 | -moz-hyphens: manual;
464 | -ms-hyphens: manual;
465 | -webkit-hyphens: manual;
466 | hyphens: manual;
467 | }
468 |
469 | /* -- hlist styles ---------------------------------------------------------- */
470 |
471 | table.hlist td {
472 | vertical-align: top;
473 | }
474 |
475 |
476 | /* -- other body styles ----------------------------------------------------- */
477 |
478 | ol.arabic {
479 | list-style: decimal;
480 | }
481 |
482 | ol.loweralpha {
483 | list-style: lower-alpha;
484 | }
485 |
486 | ol.upperalpha {
487 | list-style: upper-alpha;
488 | }
489 |
490 | ol.lowerroman {
491 | list-style: lower-roman;
492 | }
493 |
494 | ol.upperroman {
495 | list-style: upper-roman;
496 | }
497 |
498 | li > p:first-child {
499 | margin-top: 0px;
500 | }
501 |
502 | li > p:last-child {
503 | margin-bottom: 0px;
504 | }
505 |
506 | dl.footnote > dt,
507 | dl.citation > dt {
508 | float: left;
509 | }
510 |
511 | dl.footnote > dd,
512 | dl.citation > dd {
513 | margin-bottom: 0em;
514 | }
515 |
516 | dl.footnote > dd:after,
517 | dl.citation > dd:after {
518 | content: "";
519 | clear: both;
520 | }
521 |
522 | dl.field-list {
523 | display: grid;
524 | grid-template-columns: fit-content(30%) auto;
525 | }
526 |
527 | dl.field-list > dt {
528 | font-weight: bold;
529 | word-break: break-word;
530 | padding-left: 0.5em;
531 | padding-right: 5px;
532 | }
533 |
534 | dl.field-list > dt:after {
535 | content: ":";
536 | }
537 |
538 | dl.field-list > dd {
539 | padding-left: 0.5em;
540 | margin-top: 0em;
541 | margin-left: 0em;
542 | margin-bottom: 0em;
543 | }
544 |
545 | dl {
546 | margin-bottom: 15px;
547 | }
548 |
549 | dd > p:first-child {
550 | margin-top: 0px;
551 | }
552 |
553 | dd ul, dd table {
554 | margin-bottom: 10px;
555 | }
556 |
557 | dd {
558 | margin-top: 3px;
559 | margin-bottom: 10px;
560 | margin-left: 30px;
561 | }
562 |
563 | dt:target, span.highlighted {
564 | background-color: #fbe54e;
565 | }
566 |
567 | rect.highlighted {
568 | fill: #fbe54e;
569 | }
570 |
571 | dl.glossary dt {
572 | font-weight: bold;
573 | font-size: 1.1em;
574 | }
575 |
576 | .optional {
577 | font-size: 1.3em;
578 | }
579 |
580 | .sig-paren {
581 | font-size: larger;
582 | }
583 |
584 | .versionmodified {
585 | font-style: italic;
586 | }
587 |
588 | .system-message {
589 | background-color: #fda;
590 | padding: 5px;
591 | border: 3px solid red;
592 | }
593 |
594 | .footnote:target {
595 | background-color: #ffa;
596 | }
597 |
598 | .line-block {
599 | display: block;
600 | margin-top: 1em;
601 | margin-bottom: 1em;
602 | }
603 |
604 | .line-block .line-block {
605 | margin-top: 0;
606 | margin-bottom: 0;
607 | margin-left: 1.5em;
608 | }
609 |
610 | .guilabel, .menuselection {
611 | font-family: sans-serif;
612 | }
613 |
614 | .accelerator {
615 | text-decoration: underline;
616 | }
617 |
618 | .classifier {
619 | font-style: oblique;
620 | }
621 |
622 | .classifier:before {
623 | font-style: normal;
624 | margin: 0.5em;
625 | content: ":";
626 | }
627 |
628 | abbr, acronym {
629 | border-bottom: dotted 1px;
630 | cursor: help;
631 | }
632 |
633 | /* -- code displays --------------------------------------------------------- */
634 |
635 | pre {
636 | overflow: auto;
637 | overflow-y: hidden; /* fixes display issues on Chrome browsers */
638 | }
639 |
640 | span.pre {
641 | -moz-hyphens: none;
642 | -ms-hyphens: none;
643 | -webkit-hyphens: none;
644 | hyphens: none;
645 | }
646 |
647 | td.linenos pre {
648 | padding: 5px 0px;
649 | border: 0;
650 | background-color: transparent;
651 | color: #aaa;
652 | }
653 |
654 | table.highlighttable {
655 | margin-left: 0.5em;
656 | }
657 |
658 | table.highlighttable td {
659 | padding: 0 0.5em 0 0.5em;
660 | }
661 |
662 | div.code-block-caption {
663 | padding: 2px 5px;
664 | font-size: small;
665 | }
666 |
667 | div.code-block-caption code {
668 | background-color: transparent;
669 | }
670 |
671 | div.code-block-caption + div > div.highlight > pre {
672 | margin-top: 0;
673 | }
674 |
675 | div.doctest > div.highlight span.gp { /* gp: Generic.Prompt */
676 | user-select: none;
677 | }
678 |
679 | div.code-block-caption span.caption-number {
680 | padding: 0.1em 0.3em;
681 | font-style: italic;
682 | }
683 |
684 | div.code-block-caption span.caption-text {
685 | }
686 |
687 | div.literal-block-wrapper {
688 | padding: 1em 1em 0;
689 | }
690 |
691 | div.literal-block-wrapper div.highlight {
692 | margin: 0;
693 | }
694 |
695 | code.descname {
696 | background-color: transparent;
697 | font-weight: bold;
698 | font-size: 1.2em;
699 | }
700 |
701 | code.descclassname {
702 | background-color: transparent;
703 | }
704 |
705 | code.xref, a code {
706 | background-color: transparent;
707 | font-weight: bold;
708 | }
709 |
710 | h1 code, h2 code, h3 code, h4 code, h5 code, h6 code {
711 | background-color: transparent;
712 | }
713 |
714 | .viewcode-link {
715 | float: right;
716 | }
717 |
718 | .viewcode-back {
719 | float: right;
720 | font-family: sans-serif;
721 | }
722 |
723 | div.viewcode-block:target {
724 | margin: -1px -10px;
725 | padding: 0 10px;
726 | }
727 |
728 | /* -- math display ---------------------------------------------------------- */
729 |
730 | img.math {
731 | vertical-align: middle;
732 | }
733 |
734 | div.body div.math p {
735 | text-align: center;
736 | }
737 |
738 | span.eqno {
739 | float: right;
740 | }
741 |
742 | span.eqno a.headerlink {
743 | position: relative;
744 | left: 0px;
745 | z-index: 1;
746 | }
747 |
748 | div.math:hover a.headerlink {
749 | visibility: visible;
750 | }
751 |
752 | /* -- printout stylesheet --------------------------------------------------- */
753 |
754 | @media print {
755 | div.document,
756 | div.documentwrapper,
757 | div.bodywrapper {
758 | margin: 0 !important;
759 | width: 100%;
760 | }
761 |
762 | div.sphinxsidebar,
763 | div.related,
764 | div.footer,
765 | #top-link {
766 | display: none;
767 | }
768 | }
--------------------------------------------------------------------------------
/docs/examples/search-ip.rst:
--------------------------------------------------------------------------------
1 | Search Information on an IP
2 | ---------------------------
3 |
4 | .. code-block:: python
5 |
6 | #!/usr/bin/env python
7 | # onyphe_ip.py
8 | #
9 | # Author: Sebastien Larinier
10 |
11 | import onyphe
12 |
13 | API_KEY = "YOUR_API_KEY"
14 | ip = sys.argv[1]
15 | #Input validation
16 | if len(sys.argv) == 1:
17 | print('Usage: %s ' % sys.argv[0])
18 | sys.exit(1)
19 | try:
20 | # Setup the ap
21 | api = onyphe.Onyphe(API_KEY)
22 | # Perform the search
23 | result = api.summary_ip(ip)
24 | print(json.dumps(result))
25 | except Exception as e:
26 | print('Error: %s' % e)
27 | sys.exit(1)
28 |
29 |
30 | .. code-block:: python
31 |
32 | {'count': 32,
33 | 'error': 0,
34 | 'myip': '176.169.140.4',
35 | 'results': [{'@category': 'geoloc',
36 | '@timestamp': '2017-12-01T12:32:23.000Z',
37 | '@type': 'ip',
38 | 'asn': 'AS15169',
39 | 'city': '',
40 | 'country': 'US',
41 | 'country_name': 'United States',
42 | 'geolocation': '37.7510,-97.8220',
43 | 'ip': '8.8.8.8',
44 | 'ipv6': 'false',
45 | 'latitude': '37.7510',
46 | 'longitude': '-97.8220',
47 | 'organization': 'Google LLC',
48 | 'subnet': '8.8.0.0/19'},
49 | {'@category': 'inetnum',
50 | '@timestamp': '1970-01-01T00:00:00.000Z',
51 | '@type': 'ip',
52 | 'country': 'US',
53 | 'information': ['Undisclosed'],
54 | 'netname': 'Undisclosed',
55 | 'seen_date': '1970-01-01',
56 | 'source': 'Undisclosed',
57 | 'subnet': 'Undisclosed'},
58 | {'@category': 'pastries',
59 | '@timestamp': '2017-12-01T10:56:10.000Z',
60 | '@type': 'pastebin',
61 | 'domain': ['discordapp.com', 'boards.net', '1blu.de', 'google.com'],
62 | 'hostname': ['station.boards.net',
63 | 'rv1898.1blu.de',
64 | 'google-public-dns-a.google.com'],
65 | 'ip': ['104.16.59.5',
66 | '104.16.20.142',
67 | '104.16.22.142',
68 | '104.16.23.142',
69 | '178.254.7.216',
70 | '104.16.19.142',
71 | '104.16.21.142',
72 | '104.16.58.5',
73 | '8.8.8.8'],
74 | 'key': 'CSWkvpgt',
75 | 'seen_date': '2017-12-01'},
76 | {'@category': 'pastries',
77 | '@timestamp': '2017-12-01T10:12:19.000Z',
78 | '@type': 'pastebin',
79 | 'domain': ['google.com'],
80 | 'hostname': ['google-public-dns-a.google.com',
81 | 'google-public-dns-b.google.com'],
82 | 'ip': ['8.8.8.8',
83 | '255.0.0.0',
84 | '192.168.160.1',
85 | '192.168.52.128',
86 | '8.8.4.4',
87 | '192.168.52.0',
88 | '255.255.255.0',
89 | '255.255.255.255',
90 | '192.168.52.255',
91 | '127.0.0.1',
92 | 'fe80::20c:29ff:fea1:d692'],
93 | 'key': 'rqDDrRaz',
94 | 'seen_date': '2017-12-01'},
95 | {'@category': 'pastries',
96 | '@timestamp': '2017-12-01T05:52:59.000Z',
97 | '@type': 'pastebin',
98 | 'domain': ['raspbian.org',
99 | 'google.com',
100 | 'githubusercontent.com',
101 | 'com.br',
102 | 'abuse.ch',
103 | 'hosts-file.net',
104 | 'malwaredomains.com',
105 | 'gt500.org',
106 | 'sysctl.org',
107 | 'amazonaws.com',
108 | 'ovh.net',
109 | 'co.uk',
110 | 'amazon.com'],
111 | 'hostname': ['zeustracker.abuse.ch',
112 | 'gist.githubusercontent.com',
113 | '5-153-225-231.no-reverse-dns-set.bytemark.co.uk',
114 | '210-29.amazon.com',
115 | 'raw.githubusercontent.com',
116 | 'mirror1.malwaredomains.com',
117 | 'bots.ovh.net',
118 | '206-80.amazon.com',
119 | 's3.amazonaws.com',
120 | 'ec2-107-22-171-143.compute-1.amazonaws.com',
121 | 'gt500.org',
122 | 'google-public-dns-a.google.com',
123 | 'www.raspbian.org',
124 | '186.216.161.195.user.vctelecom.com.br',
125 | '166-22.amazon.com',
126 | 'google-public-dns-b.google.com'],
127 | 'ip': ['213.186.34.12',
128 | '72.21.206.80',
129 | '8.8.4.4',
130 | '192.168.1.1',
131 | '151.101.194.49',
132 | '151.101.0.133',
133 | '151.101.2.49',
134 | '151.101.192.133',
135 | '8.8.8.8',
136 | '139.146.167.25',
137 | 'fe80::f15e:521c:71bb:4eb4',
138 | '151.101.128.133',
139 | '127.0.0.1',
140 | '151.101.64.133',
141 | '52.216.20.75',
142 | '207.171.166.22',
143 | '2001:41c9:1:3ce:0:0:1:10',
144 | '151.101.66.49',
145 | '74.63.222.170',
146 | '151.101.130.49',
147 | '186.216.161.195',
148 | '192.168.1.10',
149 | '72.21.210.29',
150 | '5.153.225.231',
151 | '107.22.171.143'],
152 | 'key': '1eyBGtdu',
153 | 'seen_date': '2017-12-01'},
154 | {'@category': 'pastries',
155 | '@timestamp': '2017-11-30T20:03:27.000Z',
156 | '@type': 'pastebin',
157 | 'domain': ['google.com'],
158 | 'hostname': ['google-public-dns-a.google.com'],
159 | 'ip': ['fe80::441a:a7ff:fef4:8540',
160 | 'fe80::42:fdff:fe89:f73e',
161 | 'fe80::c8a9:2fff:fe24:5054',
162 | 'fe80::14c5:5aff:fe58:212d',
163 | '192.168.1.254',
164 | '192.168.122.255',
165 | '255.255.255.0',
166 | 'fe80::42:90ff:feb8:b5b0',
167 | '172.27.0.1',
168 | 'fe80::e8b7:62ff:fe85:c537',
169 | '8.8.8.8',
170 | '172.21.0.1',
171 | 'fe80::4c28:c4ff:fe34:846a',
172 | '192.168.1.0',
173 | '192.168.122.1',
174 | 'fe80::42:caff:fe92:297b',
175 | '172.18.0.1',
176 | '172.20.0.1',
177 | 'fe80::42:d2ff:fef2:fd9c',
178 | 'fe80::f07a:3dff:fe06:a2cf',
179 | '172.22.0.1',
180 | '192.168.2.0',
181 | '192.168.1.111',
182 | '127.0.0.1',
183 | '172.30.0.1',
184 | '192.168.2.1',
185 | 'fe80::5055:7fff:fe6e:71ed',
186 | 'fe80::dacb:8aff:fe7e:b00e',
187 | '192.168.1.255',
188 | '172.19.0.1',
189 | 'fe80::7cb6:9dff:fe57:ffcc',
190 | 'fe80::f41f:d4ff:fe3c:5a89',
191 | '172.17.0.1',
192 | '172.26.0.1',
193 | 'fe80::42:40ff:fe01:23c5',
194 | '192.168.2.255'],
195 | 'key': 'wdSRXk2y',
196 | 'seen_date': '2017-11-30'},
197 | {'@category': 'pastries',
198 | '@timestamp': '2017-11-30T19:24:26.000Z',
199 | '@type': 'pastebin',
200 | 'domain': ['as48707.pl', 'google.com'],
201 | 'hostname': ['google-public-dns-a.google.com',
202 | 'ip-212-91-7-33.as48707.pl',
203 | 'ip-212-91-6-58.as48707.pl'],
204 | 'ip': ['8.8.8.8', '212.91.6.58', '212.91.7.33'],
205 | 'key': 'TNbTeVXY',
206 | 'seen_date': '2017-11-30'},
207 | {'@category': 'pastries',
208 | '@timestamp': '2017-11-30T19:08:48.000Z',
209 | '@type': 'pastebin',
210 | 'domain': ['google.com'],
211 | 'hostname': ['google-public-dns-a.google.com'],
212 | 'ip': ['8.8.8.8'],
213 | 'key': '0MjevuY6',
214 | 'seen_date': '2017-11-30'},
215 | {'@category': 'pastries',
216 | '@timestamp': '2017-11-30T18:58:23.000Z',
217 | '@type': 'pastebin',
218 | 'domain': ['google.com', 'github.com'],
219 | 'hostname': ['lb-192-30-253-113-iad.github.com',
220 | 'google-public-dns-a.google.com',
221 | 'lb-192-30-253-112-iad.github.com'],
222 | 'ip': ['8.8.8.8', '192.30.253.112', '192.30.253.113'],
223 | 'key': '0wUc90E1',
224 | 'seen_date': '2017-11-30'},
225 | {'@category': 'pastries',
226 | '@timestamp': '2017-11-30T14:46:07.000Z',
227 | '@type': 'pastebin',
228 | 'domain': ['lwn.net', 'google.com'],
229 | 'hostname': ['google-public-dns-a.google.com', 'prod.lwn.net'],
230 | 'ip': ['45.33.94.129',
231 | '255.255.255.255',
232 | '10.0.0.1',
233 | '2600:3c03:0:0:f03c:91ff:fe61:5c5b',
234 | '8.8.8.8',
235 | 'fe80::ce51:67bd:73e8:fe63'],
236 | 'key': '6jFXSW0s',
237 | 'seen_date': '2017-11-30'},
238 | {'@category': 'pastries',
239 | '@timestamp': '2017-11-30T14:29:21.000Z',
240 | '@type': 'pastebin',
241 | 'domain': ['google.com'],
242 | 'hostname': ['google-public-dns-a.google.com'],
243 | 'ip': ['8.8.8.8', '127.0.0.1'],
244 | 'key': 'T2UFfRFW',
245 | 'seen_date': '2017-11-30'},
246 | {'@category': 'pastries',
247 | '@timestamp': '2017-11-30T14:01:17.000Z',
248 | '@type': 'pastebin',
249 | 'domain': ['google.com'],
250 | 'hostname': ['google-public-dns-a.google.com'],
251 | 'ip': ['10.0.0.1', '255.255.255.255', '8.8.8.8'],
252 | 'key': 'RaYZP25y',
253 | 'seen_date': '2017-11-30'},
254 | {'@category': 'synscan',
255 | '@timestamp': '2017-11-26T23:47:45.000Z',
256 | '@type': 'port-53',
257 | 'asn': 'AS15169',
258 | 'country': 'US',
259 | 'ip': '8.8.8.8',
260 | 'location': '37.7510,-97.8220',
261 | 'organization': 'Google LLC',
262 | 'os': 'Linux',
263 | 'port': '53',
264 | 'seen_date': '2017-11-26'},
265 | {'@category': 'synscan',
266 | '@timestamp': '2017-11-26T22:47:46.000Z',
267 | '@type': 'port-53',
268 | 'asn': 'AS15169',
269 | 'country': 'US',
270 | 'ip': '8.8.8.8',
271 | 'location': '37.7510,-97.8220',
272 | 'organization': 'Google LLC',
273 | 'os': 'Linux',
274 | 'port': '53',
275 | 'seen_date': '2017-11-26'},
276 | {'@category': 'synscan',
277 | '@timestamp': '2017-11-26T22:47:42.000Z',
278 | '@type': 'port-53',
279 | 'asn': 'AS15169',
280 | 'country': 'US',
281 | 'ip': '8.8.8.8',
282 | 'location': '37.7510,-97.8220',
283 | 'organization': 'Google LLC',
284 | 'os': 'Linux',
285 | 'port': '53',
286 | 'seen_date': '2017-11-26'},
287 | {'@category': 'synscan',
288 | '@timestamp': '2017-11-26T22:47:31.000Z',
289 | '@type': 'port-53',
290 | 'asn': 'AS15169',
291 | 'country': 'US',
292 | 'ip': '8.8.8.8',
293 | 'location': '37.7510,-97.8220',
294 | 'organization': 'Google LLC',
295 | 'os': 'Linux',
296 | 'port': '53',
297 | 'seen_date': '2017-11-26'},
298 | {'@category': 'synscan',
299 | '@timestamp': '2017-11-26T22:47:31.000Z',
300 | '@type': 'port-53',
301 | 'asn': 'AS15169',
302 | 'country': 'US',
303 | 'ip': '8.8.8.8',
304 | 'location': '37.7510,-97.8220',
305 | 'organization': 'Google LLC',
306 | 'os': 'Linux',
307 | 'port': '53',
308 | 'seen_date': '2017-11-26'},
309 | {'@category': 'synscan',
310 | '@timestamp': '2017-11-26T22:47:26.000Z',
311 | '@type': 'port-53',
312 | 'asn': 'AS15169',
313 | 'country': 'US',
314 | 'ip': '8.8.8.8',
315 | 'location': '37.7510,-97.8220',
316 | 'organization': 'Google LLC',
317 | 'os': 'Linux',
318 | 'port': '53',
319 | 'seen_date': '2017-11-26'},
320 | {'@category': 'synscan',
321 | '@timestamp': '2017-11-26T22:47:24.000Z',
322 | '@type': 'port-53',
323 | 'asn': 'AS15169',
324 | 'country': 'US',
325 | 'ip': '8.8.8.8',
326 | 'location': '37.7510,-97.8220',
327 | 'organization': 'Google LLC',
328 | 'os': 'Linux',
329 | 'port': '53',
330 | 'seen_date': '2017-11-26'},
331 | {'@category': 'synscan',
332 | '@timestamp': '2017-11-26T22:47:20.000Z',
333 | '@type': 'port-53',
334 | 'asn': 'AS15169',
335 | 'country': 'US',
336 | 'ip': '8.8.8.8',
337 | 'location': '37.7510,-97.8220',
338 | 'organization': 'Google LLC',
339 | 'os': 'Linux',
340 | 'port': '53',
341 | 'seen_date': '2017-11-26'},
342 | {'@category': 'synscan',
343 | '@timestamp': '2017-11-26T22:47:20.000Z',
344 | '@type': 'port-53',
345 | 'asn': 'AS15169',
346 | 'country': 'US',
347 | 'ip': '8.8.8.8',
348 | 'location': '37.7510,-97.8220',
349 | 'organization': 'Google LLC',
350 | 'os': 'Linux',
351 | 'port': '53',
352 | 'seen_date': '2017-11-26'},
353 | {'@category': 'synscan',
354 | '@timestamp': '2017-11-26T22:47:17.000Z',
355 | '@type': 'port-53',
356 | 'asn': 'AS15169',
357 | 'country': 'US',
358 | 'ip': '8.8.8.8',
359 | 'location': '37.7510,-97.8220',
360 | 'organization': 'Google LLC',
361 | 'os': 'Linux',
362 | 'port': '53',
363 | 'seen_date': '2017-11-26'},
364 | {'@category': 'resolver',
365 | '@timestamp': '2017-11-26T14:37:09.000Z',
366 | '@type': 'forward',
367 | 'domain': 'better-than.tv',
368 | 'forward': 'area61.better-than.tv',
369 | 'ip': '8.8.8.8',
370 | 'ipv6': 0,
371 | 'seen_date': '2017-11-26'},
372 | {'@category': 'resolver',
373 | '@timestamp': '2017-11-25T15:19:42.000Z',
374 | '@type': 'reverse',
375 | 'domain': 'google.com',
376 | 'ip': '8.8.8.8',
377 | 'ipv6': 0,
378 | 'reverse': 'google-public-dns-a.google.com',
379 | 'seen_date': '2017-11-25'},
380 | {'@category': 'resolver',
381 | '@timestamp': '2017-11-21T21:38:10.000Z',
382 | '@type': 'reverse',
383 | 'domain': 'google.com',
384 | 'ip': '8.8.8.8',
385 | 'ipv6': 0,
386 | 'reverse': 'google-public-dns-a.google.com',
387 | 'seen_date': '2017-11-21'},
388 | {'@category': 'resolver',
389 | '@timestamp': '2017-11-20T03:34:43.000Z',
390 | '@type': 'forward',
391 | 'domain': 'apa.at',
392 | 'forward': 'apasfwl.apa.at',
393 | 'ip': '8.8.8.8',
394 | 'ipv6': 0,
395 | 'seen_date': '2017-11-20'},
396 | {'@category': 'resolver',
397 | '@timestamp': '2017-11-18T14:44:02.000Z',
398 | '@type': 'reverse',
399 | 'domain': 'google.com',
400 | 'ip': '8.8.8.8',
401 | 'ipv6': 0,
402 | 'reverse': 'google-public-dns-a.google.com',
403 | 'seen_date': '2017-11-18'},
404 | {'@category': 'resolver',
405 | '@timestamp': '2017-11-16T17:31:34.000Z',
406 | '@type': 'reverse',
407 | 'domain': 'google.com',
408 | 'ip': '8.8.8.8',
409 | 'ipv6': 0,
410 | 'reverse': 'google-public-dns-a.google.com',
411 | 'seen_date': '2017-11-16'},
412 | {'@category': 'resolver',
413 | '@timestamp': '2017-11-15T21:13:31.000Z',
414 | '@type': 'reverse',
415 | 'domain': 'google.com',
416 | 'ip': '8.8.8.8',
417 | 'ipv6': 0,
418 | 'reverse': 'google-public-dns-a.google.com',
419 | 'seen_date': '2017-11-15'},
420 | {'@category': 'resolver',
421 | '@timestamp': '2017-11-14T17:22:21.000Z',
422 | '@type': 'forward',
423 | 'domain': 'bot.nu',
424 | 'forward': 'bot.nu',
425 | 'ip': '8.8.8.8',
426 | 'ipv6': 0,
427 | 'seen_date': '2017-11-14'},
428 | {'@category': 'resolver',
429 | '@timestamp': '2017-11-14T04:58:21.000Z',
430 | '@type': 'reverse',
431 | 'domain': 'google.com',
432 | 'ip': '8.8.8.8',
433 | 'ipv6': 0,
434 | 'reverse': 'google-public-dns-a.google.com',
435 | 'seen_date': '2017-11-14'},
436 | {'@category': 'resolver',
437 | '@timestamp': '2017-11-13T18:45:27.000Z',
438 | '@type': 'reverse',
439 | 'domain': 'google.com',
440 | 'ip': '8.8.8.8',
441 | 'ipv6': 0,
442 | 'reverse': 'google-public-dns-a.google.com',
443 | 'seen_date': '2017-11-13'}],
444 | 'status': 'ok',
445 | 'took': '0.098',
446 | 'total': 1481}
447 |
--------------------------------------------------------------------------------
/docs/_build/html/_static/searchtools.js:
--------------------------------------------------------------------------------
1 | /*
2 | * searchtools.js
3 | * ~~~~~~~~~~~~~~~~
4 | *
5 | * Sphinx JavaScript utilities for the full-text search.
6 | *
7 | * :copyright: Copyright 2007-2020 by the Sphinx team, see AUTHORS.
8 | * :license: BSD, see LICENSE for details.
9 | *
10 | */
11 |
12 | if (!Scorer) {
13 | /**
14 | * Simple result scoring code.
15 | */
16 | var Scorer = {
17 | // Implement the following function to further tweak the score for each result
18 | // The function takes a result array [filename, title, anchor, descr, score]
19 | // and returns the new score.
20 | /*
21 | score: function(result) {
22 | return result[4];
23 | },
24 | */
25 |
26 | // query matches the full name of an object
27 | objNameMatch: 11,
28 | // or matches in the last dotted part of the object name
29 | objPartialMatch: 6,
30 | // Additive scores depending on the priority of the object
31 | objPrio: {0: 15, // used to be importantResults
32 | 1: 5, // used to be objectResults
33 | 2: -5}, // used to be unimportantResults
34 | // Used when the priority is not in the mapping.
35 | objPrioDefault: 0,
36 |
37 | // query found in title
38 | title: 15,
39 | partialTitle: 7,
40 | // query found in terms
41 | term: 5,
42 | partialTerm: 2
43 | };
44 | }
45 |
46 | if (!splitQuery) {
47 | function splitQuery(query) {
48 | return query.split(/\s+/);
49 | }
50 | }
51 |
52 | /**
53 | * Search Module
54 | */
55 | var Search = {
56 |
57 | _index : null,
58 | _queued_query : null,
59 | _pulse_status : -1,
60 |
61 | htmlToText : function(htmlString) {
62 | var htmlElement = document.createElement('span');
63 | htmlElement.innerHTML = htmlString;
64 | $(htmlElement).find('.headerlink').remove();
65 | docContent = $(htmlElement).find('[role=main]')[0];
66 | if(docContent === undefined) {
67 | console.warn("Content block not found. Sphinx search tries to obtain it " +
68 | "via '[role=main]'. Could you check your theme or template.");
69 | return "";
70 | }
71 | return docContent.textContent || docContent.innerText;
72 | },
73 |
74 | init : function() {
75 | var params = $.getQueryParameters();
76 | if (params.q) {
77 | var query = params.q[0];
78 | $('input[name="q"]')[0].value = query;
79 | this.performSearch(query);
80 | }
81 | },
82 |
83 | loadIndex : function(url) {
84 | $.ajax({type: "GET", url: url, data: null,
85 | dataType: "script", cache: true,
86 | complete: function(jqxhr, textstatus) {
87 | if (textstatus != "success") {
88 | document.getElementById("searchindexloader").src = url;
89 | }
90 | }});
91 | },
92 |
93 | setIndex : function(index) {
94 | var q;
95 | this._index = index;
96 | if ((q = this._queued_query) !== null) {
97 | this._queued_query = null;
98 | Search.query(q);
99 | }
100 | },
101 |
102 | hasIndex : function() {
103 | return this._index !== null;
104 | },
105 |
106 | deferQuery : function(query) {
107 | this._queued_query = query;
108 | },
109 |
110 | stopPulse : function() {
111 | this._pulse_status = 0;
112 | },
113 |
114 | startPulse : function() {
115 | if (this._pulse_status >= 0)
116 | return;
117 | function pulse() {
118 | var i;
119 | Search._pulse_status = (Search._pulse_status + 1) % 4;
120 | var dotString = '';
121 | for (i = 0; i < Search._pulse_status; i++)
122 | dotString += '.';
123 | Search.dots.text(dotString);
124 | if (Search._pulse_status > -1)
125 | window.setTimeout(pulse, 500);
126 | }
127 | pulse();
128 | },
129 |
130 | /**
131 | * perform a search for something (or wait until index is loaded)
132 | */
133 | performSearch : function(query) {
134 | // create the required interface elements
135 | this.out = $('#search-results');
136 | this.title = $('' + _('Searching') + ' ').appendTo(this.out);
137 | this.dots = $(' ').appendTo(this.title);
138 | this.status = $('
').appendTo(this.out);
139 | this.output = $('').appendTo(this.out);
140 |
141 | $('#search-progress').text(_('Preparing search...'));
142 | this.startPulse();
143 |
144 | // index already loaded, the browser was quick!
145 | if (this.hasIndex())
146 | this.query(query);
147 | else
148 | this.deferQuery(query);
149 | },
150 |
151 | /**
152 | * execute search (requires search index to be loaded)
153 | */
154 | query : function(query) {
155 | var i;
156 |
157 | // stem the searchterms and add them to the correct list
158 | var stemmer = new Stemmer();
159 | var searchterms = [];
160 | var excluded = [];
161 | var hlterms = [];
162 | var tmp = splitQuery(query);
163 | var objectterms = [];
164 | for (i = 0; i < tmp.length; i++) {
165 | if (tmp[i] !== "") {
166 | objectterms.push(tmp[i].toLowerCase());
167 | }
168 |
169 | if ($u.indexOf(stopwords, tmp[i].toLowerCase()) != -1 || tmp[i].match(/^\d+$/) ||
170 | tmp[i] === "") {
171 | // skip this "word"
172 | continue;
173 | }
174 | // stem the word
175 | var word = stemmer.stemWord(tmp[i].toLowerCase());
176 | // prevent stemmer from cutting word smaller than two chars
177 | if(word.length < 3 && tmp[i].length >= 3) {
178 | word = tmp[i];
179 | }
180 | var toAppend;
181 | // select the correct list
182 | if (word[0] == '-') {
183 | toAppend = excluded;
184 | word = word.substr(1);
185 | }
186 | else {
187 | toAppend = searchterms;
188 | hlterms.push(tmp[i].toLowerCase());
189 | }
190 | // only add if not already in the list
191 | if (!$u.contains(toAppend, word))
192 | toAppend.push(word);
193 | }
194 | var highlightstring = '?highlight=' + $.urlencode(hlterms.join(" "));
195 |
196 | // console.debug('SEARCH: searching for:');
197 | // console.info('required: ', searchterms);
198 | // console.info('excluded: ', excluded);
199 |
200 | // prepare search
201 | var terms = this._index.terms;
202 | var titleterms = this._index.titleterms;
203 |
204 | // array of [filename, title, anchor, descr, score]
205 | var results = [];
206 | $('#search-progress').empty();
207 |
208 | // lookup as object
209 | for (i = 0; i < objectterms.length; i++) {
210 | var others = [].concat(objectterms.slice(0, i),
211 | objectterms.slice(i+1, objectterms.length));
212 | results = results.concat(this.performObjectSearch(objectterms[i], others));
213 | }
214 |
215 | // lookup as search terms in fulltext
216 | results = results.concat(this.performTermsSearch(searchterms, excluded, terms, titleterms));
217 |
218 | // let the scorer override scores with a custom scoring function
219 | if (Scorer.score) {
220 | for (i = 0; i < results.length; i++)
221 | results[i][4] = Scorer.score(results[i]);
222 | }
223 |
224 | // now sort the results by score (in opposite order of appearance, since the
225 | // display function below uses pop() to retrieve items) and then
226 | // alphabetically
227 | results.sort(function(a, b) {
228 | var left = a[4];
229 | var right = b[4];
230 | if (left > right) {
231 | return 1;
232 | } else if (left < right) {
233 | return -1;
234 | } else {
235 | // same score: sort alphabetically
236 | left = a[1].toLowerCase();
237 | right = b[1].toLowerCase();
238 | return (left > right) ? -1 : ((left < right) ? 1 : 0);
239 | }
240 | });
241 |
242 | // for debugging
243 | //Search.lastresults = results.slice(); // a copy
244 | //console.info('search results:', Search.lastresults);
245 |
246 | // print the results
247 | var resultCount = results.length;
248 | function displayNextItem() {
249 | // results left, load the summary and display it
250 | if (results.length) {
251 | var item = results.pop();
252 | var listItem = $(' ');
253 | var requestUrl = "";
254 | if (DOCUMENTATION_OPTIONS.BUILDER === 'dirhtml') {
255 | // dirhtml builder
256 | var dirname = item[0] + '/';
257 | if (dirname.match(/\/index\/$/)) {
258 | dirname = dirname.substring(0, dirname.length-6);
259 | } else if (dirname == 'index/') {
260 | dirname = '';
261 | }
262 | requestUrl = DOCUMENTATION_OPTIONS.URL_ROOT + dirname;
263 |
264 | } else {
265 | // normal html builders
266 | requestUrl = DOCUMENTATION_OPTIONS.URL_ROOT + item[0] + DOCUMENTATION_OPTIONS.FILE_SUFFIX;
267 | }
268 | listItem.append($(' ').attr('href',
269 | requestUrl +
270 | highlightstring + item[2]).html(item[1]));
271 | if (item[3]) {
272 | listItem.append($(' (' + item[3] + ') '));
273 | Search.output.append(listItem);
274 | listItem.slideDown(5, function() {
275 | displayNextItem();
276 | });
277 | } else if (DOCUMENTATION_OPTIONS.HAS_SOURCE) {
278 | $.ajax({url: requestUrl,
279 | dataType: "text",
280 | complete: function(jqxhr, textstatus) {
281 | var data = jqxhr.responseText;
282 | if (data !== '' && data !== undefined) {
283 | listItem.append(Search.makeSearchSummary(data, searchterms, hlterms));
284 | }
285 | Search.output.append(listItem);
286 | listItem.slideDown(5, function() {
287 | displayNextItem();
288 | });
289 | }});
290 | } else {
291 | // no source available, just display title
292 | Search.output.append(listItem);
293 | listItem.slideDown(5, function() {
294 | displayNextItem();
295 | });
296 | }
297 | }
298 | // search finished, update title and status message
299 | else {
300 | Search.stopPulse();
301 | Search.title.text(_('Search Results'));
302 | if (!resultCount)
303 | Search.status.text(_('Your search did not match any documents. Please make sure that all words are spelled correctly and that you\'ve selected enough categories.'));
304 | else
305 | Search.status.text(_('Search finished, found %s page(s) matching the search query.').replace('%s', resultCount));
306 | Search.status.fadeIn(500);
307 | }
308 | }
309 | displayNextItem();
310 | },
311 |
312 | /**
313 | * search for object names
314 | */
315 | performObjectSearch : function(object, otherterms) {
316 | var filenames = this._index.filenames;
317 | var docnames = this._index.docnames;
318 | var objects = this._index.objects;
319 | var objnames = this._index.objnames;
320 | var titles = this._index.titles;
321 |
322 | var i;
323 | var results = [];
324 |
325 | for (var prefix in objects) {
326 | for (var name in objects[prefix]) {
327 | var fullname = (prefix ? prefix + '.' : '') + name;
328 | var fullnameLower = fullname.toLowerCase()
329 | if (fullnameLower.indexOf(object) > -1) {
330 | var score = 0;
331 | var parts = fullnameLower.split('.');
332 | // check for different match types: exact matches of full name or
333 | // "last name" (i.e. last dotted part)
334 | if (fullnameLower == object || parts[parts.length - 1] == object) {
335 | score += Scorer.objNameMatch;
336 | // matches in last name
337 | } else if (parts[parts.length - 1].indexOf(object) > -1) {
338 | score += Scorer.objPartialMatch;
339 | }
340 | var match = objects[prefix][name];
341 | var objname = objnames[match[1]][2];
342 | var title = titles[match[0]];
343 | // If more than one term searched for, we require other words to be
344 | // found in the name/title/description
345 | if (otherterms.length > 0) {
346 | var haystack = (prefix + ' ' + name + ' ' +
347 | objname + ' ' + title).toLowerCase();
348 | var allfound = true;
349 | for (i = 0; i < otherterms.length; i++) {
350 | if (haystack.indexOf(otherterms[i]) == -1) {
351 | allfound = false;
352 | break;
353 | }
354 | }
355 | if (!allfound) {
356 | continue;
357 | }
358 | }
359 | var descr = objname + _(', in ') + title;
360 |
361 | var anchor = match[3];
362 | if (anchor === '')
363 | anchor = fullname;
364 | else if (anchor == '-')
365 | anchor = objnames[match[1]][1] + '-' + fullname;
366 | // add custom score for some objects according to scorer
367 | if (Scorer.objPrio.hasOwnProperty(match[2])) {
368 | score += Scorer.objPrio[match[2]];
369 | } else {
370 | score += Scorer.objPrioDefault;
371 | }
372 | results.push([docnames[match[0]], fullname, '#'+anchor, descr, score, filenames[match[0]]]);
373 | }
374 | }
375 | }
376 |
377 | return results;
378 | },
379 |
380 | /**
381 | * search for full-text terms in the index
382 | */
383 | performTermsSearch : function(searchterms, excluded, terms, titleterms) {
384 | var docnames = this._index.docnames;
385 | var filenames = this._index.filenames;
386 | var titles = this._index.titles;
387 |
388 | var i, j, file;
389 | var fileMap = {};
390 | var scoreMap = {};
391 | var results = [];
392 |
393 | // perform the search on the required terms
394 | for (i = 0; i < searchterms.length; i++) {
395 | var word = searchterms[i];
396 | var files = [];
397 | var _o = [
398 | {files: terms[word], score: Scorer.term},
399 | {files: titleterms[word], score: Scorer.title}
400 | ];
401 | // add support for partial matches
402 | if (word.length > 2) {
403 | for (var w in terms) {
404 | if (w.match(word) && !terms[word]) {
405 | _o.push({files: terms[w], score: Scorer.partialTerm})
406 | }
407 | }
408 | for (var w in titleterms) {
409 | if (w.match(word) && !titleterms[word]) {
410 | _o.push({files: titleterms[w], score: Scorer.partialTitle})
411 | }
412 | }
413 | }
414 |
415 | // no match but word was a required one
416 | if ($u.every(_o, function(o){return o.files === undefined;})) {
417 | break;
418 | }
419 | // found search word in contents
420 | $u.each(_o, function(o) {
421 | var _files = o.files;
422 | if (_files === undefined)
423 | return
424 |
425 | if (_files.length === undefined)
426 | _files = [_files];
427 | files = files.concat(_files);
428 |
429 | // set score for the word in each file to Scorer.term
430 | for (j = 0; j < _files.length; j++) {
431 | file = _files[j];
432 | if (!(file in scoreMap))
433 | scoreMap[file] = {};
434 | scoreMap[file][word] = o.score;
435 | }
436 | });
437 |
438 | // create the mapping
439 | for (j = 0; j < files.length; j++) {
440 | file = files[j];
441 | if (file in fileMap && fileMap[file].indexOf(word) === -1)
442 | fileMap[file].push(word);
443 | else
444 | fileMap[file] = [word];
445 | }
446 | }
447 |
448 | // now check if the files don't contain excluded terms
449 | for (file in fileMap) {
450 | var valid = true;
451 |
452 | // check if all requirements are matched
453 | var filteredTermCount = // as search terms with length < 3 are discarded: ignore
454 | searchterms.filter(function(term){return term.length > 2}).length
455 | if (
456 | fileMap[file].length != searchterms.length &&
457 | fileMap[file].length != filteredTermCount
458 | ) continue;
459 |
460 | // ensure that none of the excluded terms is in the search result
461 | for (i = 0; i < excluded.length; i++) {
462 | if (terms[excluded[i]] == file ||
463 | titleterms[excluded[i]] == file ||
464 | $u.contains(terms[excluded[i]] || [], file) ||
465 | $u.contains(titleterms[excluded[i]] || [], file)) {
466 | valid = false;
467 | break;
468 | }
469 | }
470 |
471 | // if we have still a valid result we can add it to the result list
472 | if (valid) {
473 | // select one (max) score for the file.
474 | // for better ranking, we should calculate ranking by using words statistics like basic tf-idf...
475 | var score = $u.max($u.map(fileMap[file], function(w){return scoreMap[file][w]}));
476 | results.push([docnames[file], titles[file], '', null, score, filenames[file]]);
477 | }
478 | }
479 | return results;
480 | },
481 |
482 | /**
483 | * helper function to return a node containing the
484 | * search summary for a given text. keywords is a list
485 | * of stemmed words, hlwords is the list of normal, unstemmed
486 | * words. the first one is used to find the occurrence, the
487 | * latter for highlighting it.
488 | */
489 | makeSearchSummary : function(htmlText, keywords, hlwords) {
490 | var text = Search.htmlToText(htmlText);
491 | var textLower = text.toLowerCase();
492 | var start = 0;
493 | $.each(keywords, function() {
494 | var i = textLower.indexOf(this.toLowerCase());
495 | if (i > -1)
496 | start = i;
497 | });
498 | start = Math.max(start - 120, 0);
499 | var excerpt = ((start > 0) ? '...' : '') +
500 | $.trim(text.substr(start, 240)) +
501 | ((start + 240 - text.length) ? '...' : '');
502 | var rv = $('
').text(excerpt);
503 | $.each(hlwords, function() {
504 | rv = rv.highlightText(this, 'highlighted');
505 | });
506 | return rv;
507 | }
508 | };
509 |
510 | $(document).ready(function() {
511 | Search.init();
512 | });
513 |
--------------------------------------------------------------------------------
/onyphe/client.py:
--------------------------------------------------------------------------------
1 | import json
2 | import logging
3 | import os
4 | from urllib.parse import urljoin
5 | from onyphe.exception import APIError, ParamError
6 |
7 | """
8 | onyphe.client
9 | ~~~~~~~~~~~~~
10 |
11 | This module implements the Onyphe API.
12 |
13 | :copyright: (c) 2017- by Sebastien Larinier
14 | """
15 | import requests
16 | from requests.utils import quote
17 |
18 |
19 | class Onyphe:
20 | """Wrapper around the Onyphe REST
21 |
22 | :param key: The Onyphe API key that can be obtained from your account page (https://www.onyphe.io)
23 | :type key: str
24 | """
25 |
26 | def __init__(self, api_key, version="v2"):
27 | self.api_key = api_key
28 | self.base_url = "https://www.onyphe.io/api/"
29 | self.version = version
30 | self._session = requests
31 |
32 | self.methods = {
33 | "get": self._session.get,
34 | "post": self._session.post,
35 | }
36 |
37 | def _choose_url(self, uri):
38 | self.url = urljoin(self.base_url, uri)
39 |
40 | def _request(self, method, payload, json_data, files):
41 |
42 | data = None
43 | session = self.methods[method]
44 | try:
45 | if json_data:
46 | response = session(self.url, params=payload, data=json.dumps(json_data))
47 | elif files:
48 | payload["Content-Type"] = "application/json"
49 | response = session(self.url, params=payload, data=files)
50 | else:
51 | response = self.methods[method](self.url, params=payload)
52 | except:
53 | raise APIError("Unable to connect to Onyphe")
54 |
55 | if response.status_code == requests.codes.NOT_FOUND:
56 |
57 | raise APIError("Page Not found %s" % self.url)
58 | elif response.status_code == requests.codes.FORBIDDEN:
59 | raise APIError("Access Forbidden")
60 | elif response.status_code == requests.codes.too_many_requests:
61 | raise APIError("Too Many Requests")
62 | elif response.status_code != requests.codes.OK:
63 | try:
64 | error = response.json()["text"]
65 | except Exception as e:
66 | error = "Unknown error"
67 |
68 | raise APIError(error)
69 | try:
70 | data = response.json()
71 | return data
72 |
73 | except:
74 | return response
75 |
76 | def _prepare_request(self, uri, **kwargs):
77 | params = {"apikey": self.api_key}
78 |
79 | json_data = None
80 |
81 | files = None
82 |
83 | if "page" in kwargs:
84 | params["page"] = kwargs["page"]
85 |
86 | if "json_data" in kwargs:
87 | json_data = kwargs["json_data"]
88 | if "files" in kwargs:
89 | files = kwargs["files"]
90 |
91 | method = kwargs["method"]
92 |
93 | self._choose_url(uri)
94 |
95 | data = self._request(method, params, json_data, files)
96 | if data:
97 | return data
98 |
99 | def __search(self, query, endpoint, **kwargs):
100 | return self._prepare_request(
101 | quote("/".join([self.version, "search", query])), **kwargs
102 | )
103 |
104 | def synscan(self, ip):
105 | """Call API Onyphe https://www.onyphe.io/api/v1/synscan/
106 |
107 | :param ip: IPv4 or IPv6 address
108 | :type ip: str
109 | :returns: dict -- a dictionary containing the results of the search about synscans.
110 | """
111 | return self._prepare_request(
112 | "/".join([self.version, "synscan", ip]), method="get"
113 | )
114 |
115 | def summary_ip(self, ip):
116 | """Call API Onyphe https://www.onyphe.io/api/v2/summary/ip/
117 |
118 | :param ip: IPv4 or IPv6 address
119 | :type ip: str
120 | :returns: dict -- a dictionary containing all informations of IP
121 | """
122 | return self._prepare_request(
123 | "/".join([self.version, "summary/ip", ip]), method="get"
124 | )
125 |
126 | def summary_domain(self, domain):
127 | """Call API Onyphe https://www.onyphe.io/api/v2/summary/domain/
128 |
129 | :param domain: domain
130 | :type domain: str
131 | :returns: dict -- a dictionary containing the results of the summary of domain.
132 | """
133 | return self._prepare_request(
134 | "/".join([self.version, "summary/domain", domain]), method="get"
135 | )
136 |
137 | def summary_hostname(self, hostname):
138 | """Call API Onyphe https://www.onyphe.io/api/v2/summary/hostname/
139 |
140 | :param hostname: hostname
141 | :type hostname: str
142 | :returns: dict -- a dictionary containing the results of the summary of hostname.
143 | """
144 | return self._prepare_request(
145 | "/".join([self.version, "summary/hostname", hostname]), method="get"
146 | )
147 |
148 | def simple_geoloc(self, ip):
149 | """Call API Onyphe https://www.onyphe.io/api/v2/simple/geoloc/
150 |
151 | :param ip: IPv4 or IPv6 address
152 | :type ip: str
153 | :returns: dict -- a dictionary containing the results of synscan of IP
154 | """
155 | return self._prepare_request(
156 | "/".join([self.version, "simple/geoloc", ip]), method="get"
157 | )
158 |
159 | def simple_geoloc_best(self, ip):
160 | """Call API Onyphe https://www.onyphe.io/api/v2/simple/geoloc/best
161 |
162 | :param ip: IPv4 or IPv6 address
163 | :type ip: str
164 | :returns: dict -- a dictionary containing the results of geoloc of IP
165 | """
166 | return self._prepare_request(
167 | "/".join([self.version, "simple/geoloc/best", ip]), method="get"
168 | )
169 |
170 | def simple_inetnum(self, ip):
171 | """Call API Onyphe https://www.onyphe.io/api/v2/simple/inetnum/
172 |
173 | :param ip: IPv4 or IPv6 address
174 | :type ip: str
175 | :returns: dict -- a dictionary containing the results of inetnum of IP
176 | """
177 | return self._prepare_request(
178 | "/".join([self.version, "simple/inetnum", ip]), method="get"
179 | )
180 |
181 | def simple_inetnum_best(self, ip):
182 | """Call API Onyphe https://www.onyphe.io/api/v2/simple/inetnum/best
183 |
184 | :param ip: IPv4 or IPv6 address
185 | :type ip: str
186 | :returns: dict -- a dictionary containing the results of intenum of IP
187 | """
188 | return self._prepare_request(
189 | "/".join([self.version, "simple/inetnum/best", ip]), method="get"
190 | )
191 |
192 | def simple_threatlist_best(self, ip):
193 | """Call API Onyphe https://www.onyphe.io/api/v2/simple/threatlist/best
194 |
195 | :param ip: IPv4 or IPv6 address
196 | :type ip: str
197 | :returns: dict -- a dictionary containing the results of threatlist with best API of IP
198 | """
199 | return self._prepare_request(
200 | "/".join([self.version, "simple/threatlist/best", ip]), method="get"
201 | )
202 |
203 | def simple_pastries(self, ip):
204 | """Call API Onyphe https://www.onyphe.io/api/v2/simple/pastries/
205 |
206 | :param ip: IPv4 or IPv6 address
207 | :type ip: str
208 | :returns: dict -- a dictionary containing the results of pastries of IP
209 | """
210 | return self._prepare_request(
211 | "/".join([self.version, "simple/pastries", ip]), method="get"
212 | )
213 |
214 | def simple_resolver(self, ip):
215 | """Call API Onyphe https://www.onyphe.io/api/v2/simple/resolver/
216 |
217 | :param ip: IPv4 or IPv6 address
218 | :type ip: str
219 | :returns: dict -- a dictionary containing the results of resolver of IP
220 | """
221 | return self._prepare_request(
222 | "/".join([self.version, "simple/resolver", ip]), method="get"
223 | )
224 |
225 | def simple_sniffer(self, ip):
226 | """Call API Onyphe https://www.onyphe.io/api/v2/simple/sniffer/
227 |
228 | :param ip: IPv4 or IPv6 address
229 | :type ip: str
230 | :returns: dict -- a dictionary containing the results of sniffer of IP
231 | """
232 | return self._prepare_request(
233 | "/".join([self.version, "simple/sniffer", ip]), method="get"
234 | )
235 |
236 | def simple_synscan(self, ip):
237 | """Call API Onyphe https://www.onyphe.io/api/v2/simple/synscan/
238 |
239 | :param ip: IPv4 or IPv6 address
240 | :type ip: str
241 | :returns: dict -- a dictionary containing the results of synscan of IP
242 | """
243 | return self._prepare_request(
244 | "/".join([self.version, "simple/synscan", ip]), method="get"
245 | )
246 |
247 | def simple_threatlist(self, ip):
248 | """Call API Onyphe https://www.onyphe.io/api/v2/simple/threatlist/
249 |
250 | :param ip: IPv4 or IPv6 address
251 | :type ip: str
252 | :returns: dict -- a dictionary containing the results of threatlist of IP
253 | """
254 | return self._prepare_request(
255 | "/".join([self.version, "simple/threatlist", ip]), method="get"
256 | )
257 |
258 | def simple_topsite(self, ip):
259 | """Call API Onyphe https://www.onyphe.io/api/v2/simple/topsite/
260 |
261 | :param ip: IPv4 or IPv6 address
262 | :type ip: str
263 | :returns: dict -- a dictionary containing the results of topsite of IP
264 | """
265 | return self._prepare_request(
266 | "/".join([self.version, "simple/topsite", ip]), method="get"
267 | )
268 |
269 | def simple_vulnscan(self, ip):
270 | """Call API Onyphe https://www.onyphe.io/api/v2/simple/vulnscan/
271 |
272 | :param ip: IPv4 or IPv6 address
273 | :type ip: str
274 | :returns: dict -- a dictionary containing the results of vulnscan of IP
275 | """
276 | return self._prepare_request(
277 | "/".join([self.version, "simple/vulnscan", ip]), method="get"
278 | )
279 |
280 | def simple_onionshot(self, ip):
281 | """Call API Onyphe https://www.onyphe.io/api/v2/simple/onionshot/
282 |
283 | :param ip: IPv4 or IPv6 address
284 | :type ip: str
285 | :returns: dict -- a dictionary containing the results of onionshot of IP
286 | """
287 | return self._prepare_request(
288 | "/".join([self.version, "simple/onionshot", ip]), method="get"
289 | )
290 |
291 | def simple_datashot(self, ip):
292 | """Call API Onyphe https://www.onyphe.io/api/v2/simple/datashot/
293 |
294 | :param ip: IPv4 or IPv6 address
295 | :type ip: str
296 | :returns: dict -- a dictionary containing the results of datashot of IP
297 | """
298 | return self._prepare_request(
299 | "/".join([self.version, "simple/datashot", ip]), method="get"
300 | )
301 |
302 | def simple_ctl(self, data):
303 | """Call API Onyphe https://www.onyphe.io/api/v2/ctl/{,,,
337 |
338 | :param data_md5: category of information we have for the given domain or hostname
339 | :type data_md5: str
340 | :returns: dict -- a dictionary containing Information onionscan on domain or hostname
341 | """
342 | return self._prepare_request(
343 | "/".join([self.version, "simple/datascan/datamd5", data_md5]), method="get"
344 | )
345 |
346 | def simple_resolver_forward(self, ip):
347 | """Call API Onyphe https://www.onyphe.io/api/v2/resolver/forward/
348 | :param ip: IPv4 or IPv6 address
349 | :type ip: str
350 | :returns: dict -- a dictionary containing the results of forward of IP
351 | """
352 | return self.__resolver(ip, "forward")
353 |
354 | def simple_resolver_reverse(self, ip):
355 | """Call API Onyphe https://www.onyphe.io/api/v2/resolver/reverse/
356 |
357 | :param ip: IPv4 or IPv6 address
358 | :type ip: str
359 | :returns: dict -- a dictionary containing the results of reverse of IP
360 | """
361 | return self.__resolver(ip, "reverse")
362 |
363 | def __resolver(self, ip, type_resolv):
364 | return self._prepare_request(
365 | "/".join([self.version, "simple/resolver/%s" % type_resolv, ip]),
366 | method="get",
367 | )
368 |
369 | def search(self, query, **kwargs):
370 | """Call API Onyphe https://www.onyphe.io/api/v2/search/
371 | :param query: example product:Apache port:443 os:Windows.
372 | :type query: str
373 | :return: dict -- a dictionary with result
374 | """
375 | kwargs["method"] = "get"
376 | return self.__search(query, "datascan", **kwargs)
377 |
378 | def alert_list(self):
379 | """Call API Onyphe https://www.onyphe.io/api/v2/alert/list
380 |
381 | :return: dict -- a dictionary with result
382 | """
383 | return self._prepare_request(
384 | "/".join([self.version, "alert/list"]), method="get"
385 | )
386 |
387 | def add_alert(self, query, name, email):
388 | """Call API Onyphe https://www.onyphe.io/api/v2/alert/add
389 | :param query: query language onyphe
390 | :type query: str
391 | :param name: name of alert
392 | :type name: str
393 | :param email: email to receive alerts
394 | :type email: str
395 | :return: dict -- a dictionary with result
396 | """
397 | if query and name and email:
398 | data = {"query": query, "name": name, "email": email}
399 |
400 | return self._prepare_request(
401 | "/".join([self.version, "alert/add"]), method="post", json_data=data
402 | )
403 | else:
404 | raise ParamError("Parameters Invalid")
405 |
406 | def del_alert(self, id_alert):
407 | """Call API Onyphe https://www.onyphe.io/api/v2/alert/del
408 |
409 | :param id_alert: id of alert to delete
410 | :type id_alert: str
411 | :return: dict -- a dictionary with result
412 | """
413 | if id_alert:
414 | return self._prepare_request(
415 | "/".join([self.version, "alert/del", id_alert]), method="post"
416 | )
417 | else:
418 | raise ParamError("Parameter Invalid")
419 |
420 | def bulk_summary_ip(self, path):
421 | """Call API Onyphe https://www.onyphe.io/api/v2/bulk/summary/ip
422 |
423 | :param path: path of the files with IPs
424 | :type path:str
425 | :return: dict -- a dictionary with result
426 | """
427 | if os.path.isfile(path):
428 |
429 | file_iocs = open(path, "rb")
430 | for line in self._prepare_request(
431 | "/".join([self.version, "bulk/summary/ip"]),
432 | method="post",
433 | files=file_iocs,
434 | ).iter_lines():
435 | yield json.loads(line.decode("utf-8"))
436 |
437 | else:
438 | raise ParamError("%s is no a file" % path)
439 |
440 | def bulk_summary_domain(self, path):
441 | """Call API Onyphe https://www.onyphe.io/api/v2/bulk/summary/domain
442 |
443 | :param path: path of the files with domains
444 | :type path:str
445 | :return: dict -- a dictionary with result
446 | """
447 | if os.path.isfile(path):
448 |
449 | file_iocs = open(path, "rb")
450 | for line in self._prepare_request(
451 | "/".join([self.version, "bulk/summary/domain"]),
452 | method="post",
453 | files=file_iocs,
454 | ).iter_lines():
455 | yield json.loads(line.decode("utf-8"))
456 |
457 | else:
458 | raise ParamError("%s is no a file" % path)
459 |
460 | def bulk_summary_hostname(self, path):
461 | """Call API Onyphe https://www.onyphe.io/api/v2/bulk/summary/hostname
462 |
463 | :param path: path of the files with hostnames
464 | :type path:str
465 | :return: dict -- a dictionary with result
466 | """
467 | if os.path.isfile(path):
468 |
469 | file_iocs = open(path, "rb")
470 | for line in self._prepare_request(
471 | "/".join([self.version, "bulk/summary/hostname"]),
472 | method="post",
473 | files=file_iocs,
474 | ).iter_lines():
475 | yield json.loads(line.decode("utf-8"))
476 |
477 | else:
478 | raise ParamError("%s is no a file" % path)
479 |
480 | def bulk_simple_ctl_ip(self, path):
481 | """Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/ctl/ip
482 |
483 | :param path: path of the files with IPs
484 | :type path:str
485 | :return: dict -- a dictionary with result
486 | """
487 | if os.path.isfile(path):
488 |
489 | file_iocs = open(path, "rb")
490 | for line in self._prepare_request(
491 | "/".join([self.version, "bulk/simple/clt/ip"]),
492 | method="post",
493 | files=file_iocs,
494 | ).iter_lines():
495 | yield json.loads(line.decode("utf-8"))
496 |
497 | else:
498 | raise ParamError("%s is no a file" % path)
499 |
500 | def bulk_simple_datascan_ip(self, path):
501 | """Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/datascan/ip
502 |
503 | :param path: path of the files with IPs
504 | :type path:str
505 | :return: dict -- a dictionary with result
506 | """
507 | if os.path.isfile(path):
508 |
509 | file_iocs = open(path, "rb")
510 | for line in self._prepare_request(
511 | "/".join([self.version, "bulk/simple/datascan/ip"]),
512 | method="post",
513 | files=file_iocs,
514 | ).iter_lines():
515 | yield json.loads(line.decode("utf-8"))
516 |
517 | else:
518 | raise ParamError("%s is no a file" % path)
519 |
520 | def bulk_simple_datashot_ip(self, path):
521 | """Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/datashot/ip
522 |
523 | :param path: path of the files with IPs
524 | :type path:str
525 | :return: dict -- a dictionary with result
526 | """
527 | if os.path.isfile(path):
528 |
529 | file_iocs = open(path, "rb")
530 | for line in self._prepare_request(
531 | "/".join([self.version, "bulk/simple/datashot/ip"]),
532 | method="post",
533 | files=file_iocs,
534 | ).iter_lines():
535 | yield json.loads(line.decode("utf-8"))
536 |
537 | else:
538 | raise ParamError("%s is no a file" % path)
539 |
540 | def bulk_simple_geoloc_ip(self, path):
541 | """Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/geoloc/ip
542 |
543 | :param path: path of the files with IPs
544 | :type path:str
545 | :return: dict -- a dictionary with result
546 | """
547 | if os.path.isfile(path):
548 |
549 | file_iocs = open(path, "rb")
550 | for line in self._prepare_request(
551 | "/".join([self.version, "bulk/simple/geoloc/ip"]),
552 | method="post",
553 | files=file_iocs,
554 | ).iter_lines():
555 | yield json.loads(line.decode("utf-8"))
556 |
557 | else:
558 | raise ParamError("%s is no a file" % path)
559 |
560 | def bulk_simple_inetnum_ip(self, path):
561 | """Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/inetnum/ip
562 |
563 | :param path: path of the files with IPs
564 | :type path:str
565 | :return: dict -- a dictionary with result
566 | """
567 | if os.path.isfile(path):
568 |
569 | file_iocs = open(path, "rb")
570 | for line in self._prepare_request(
571 | "/".join([self.version, "bulk/simple/inetenum/ip"]),
572 | method="post",
573 | files=file_iocs,
574 | ).iter_lines():
575 | yield json.loads(line.decode("utf-8"))
576 |
577 | else:
578 | raise ParamError("%s is no a file" % path)
579 |
580 | def bulk_simple_pastries_ip(self, path):
581 | """Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/pastries/ip
582 |
583 | :param path: path of the files with IPs
584 | :type path:str
585 | :return: dict -- a dictionary with result
586 | """
587 | if os.path.isfile(path):
588 |
589 | file_iocs = open(path, "rb")
590 | for line in self._prepare_request(
591 | "/".join([self.version, "bulk/simple/pastries/ip"]),
592 | method="post",
593 | files=file_iocs,
594 | ).iter_lines():
595 | yield json.loads(line.decode("utf-8"))
596 |
597 | else:
598 | raise ParamError("%s is no a file" % path)
599 |
600 | def bulk_simple_resolver_ip(self, path):
601 | """Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/resolver/ip
602 |
603 | :param path: path of the files with IPs
604 | :type path:str
605 | :return: dict -- a dictionary with result
606 | """
607 | if os.path.isfile(path):
608 |
609 | file_iocs = open(path, "rb")
610 | for line in self._prepare_request(
611 | "/".join([self.version, "bulk/simple/resolver/ip"]),
612 | method="post",
613 | files=file_iocs,
614 | ).iter_lines():
615 | yield json.loads(line.decode("utf-8"))
616 |
617 | else:
618 | raise ParamError("%s is no a file" % path)
619 |
620 | def bulk_simple_sniffer_ip(self, path):
621 | """Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/sniffer/ip
622 |
623 | :param path: path of the files with IPs
624 | :type path:str
625 | :return: dict -- a dictionary with result
626 | """
627 | if os.path.isfile(path):
628 |
629 | file_iocs = open(path, "rb")
630 | for line in self._prepare_request(
631 | "/".join([self.version, "bulk/simple/sniffer/ip"]),
632 | method="post",
633 | files=file_iocs,
634 | ).iter_lines():
635 | yield json.loads(line.decode("utf-8"))
636 |
637 | else:
638 | raise ParamError("%s is no a file" % path)
639 |
640 | def bulk_simple_synscan_ip(self, path):
641 | """Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/synscan/ip
642 |
643 | :param path: path of the files with IPs
644 | :type path:str
645 | :return: dict -- a dictionary with result
646 | """
647 | if os.path.isfile(path):
648 |
649 | file_iocs = open(path, "rb")
650 | for line in self._prepare_request(
651 | "/".join([self.version, "bulk/simple/synscan/ip"]),
652 | method="post",
653 | files=file_iocs,
654 | ).iter_lines():
655 | yield json.loads(line.decode("utf-8"))
656 |
657 | else:
658 | raise ParamError("%s is no a file" % path)
659 |
660 | def bulk_simple_threatlist_ip(self, path):
661 | """Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/threatlist/ip
662 |
663 | :param path: path of the files with IPs
664 | :type path:str
665 | :return: dict -- a dictionary with result
666 | """
667 | if os.path.isfile(path):
668 |
669 | file_iocs = open(path, "rb")
670 | for line in self._prepare_request(
671 | "/".join([self.version, "bulk/simple/threatlist/ip"]),
672 | method="post",
673 | files=file_iocs,
674 | ).iter_lines():
675 | yield json.loads(line.decode("utf-8"))
676 |
677 | else:
678 | raise ParamError("%s is no a file" % path)
679 |
680 | def bulk_simple_topsite_ip(self, path):
681 | """Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/topsite/ip
682 |
683 | :param path: path of the files with IPs
684 | :type path:str
685 | :return: dict -- a dictionary with result
686 | """
687 | if os.path.isfile(path):
688 |
689 | file_iocs = open(path, "rb")
690 | for line in self._prepare_request(
691 | "/".join([self.version, "bulk/simple/topsite/ip"]),
692 | method="post",
693 | files=file_iocs,
694 | ).iter_lines():
695 | yield json.loads(line.decode("utf-8"))
696 |
697 | else:
698 | raise ParamError("%s is no a file" % path)
699 |
700 | def bulk_simple_vulnscan_ip(self, path):
701 | """Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/vulnscan/ip
702 |
703 | :param path: path of the files with IPs
704 | :type path:str
705 | :return: dict -- a dictionary with result
706 | """
707 | if os.path.isfile(path):
708 |
709 | file_iocs = open(path, "rb")
710 | for line in self._prepare_request(
711 | "/".join([self.version, "bulk/simple/vulnscan/ip"]),
712 | method="post",
713 | files=file_iocs,
714 | ).iter_lines():
715 | yield json.loads(line.decode("utf-8"))
716 |
717 | else:
718 | raise ParamError("%s is no a file" % path)
719 |
720 | def bulk_simple_whois_ip(self, path):
721 | """Call API Onyphe https://www.onyphe.io/api/v2/bulk/simple/whois/ip
722 |
723 | :param path: path of the files with IPs
724 | :type path:str
725 | :return: dict -- a dictionary with result
726 | """
727 | if os.path.isfile(path):
728 |
729 | file_iocs = open(path, "rb")
730 | for line in self._prepare_request(
731 | "/".join([self.version, "bulk/simple/whois/ip"]),
732 | method="post",
733 | files=file_iocs,
734 | ).iter_lines():
735 | yield json.loads(line.decode("utf-8"))
736 |
737 | else:
738 | raise ParamError("%s is no a file" % path)
739 |
740 | def export(self, query):
741 | """Call API Onyphe https://www.onyphe.io/api/v2/export/
742 | :param query: example: category:datascan product:Nginx protocol:http os:Windows tls:true
743 | :type query:str
744 | :return: dict -- a dictionary with result
745 | """
746 | uri = quote("/".join([self.version, "export", query]))
747 | params = {"apikey": self.api_key}
748 | self._choose_url(uri)
749 | s = requests.Session()
750 | with s.get(self.url, params=params, stream=True) as r:
751 | for line in r.iter_lines():
752 | yield line
753 |
--------------------------------------------------------------------------------
/docs/_build/html/_static/underscore-1.3.1.js:
--------------------------------------------------------------------------------
1 | // Underscore.js 1.3.1
2 | // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc.
3 | // Underscore is freely distributable under the MIT license.
4 | // Portions of Underscore are inspired or borrowed from Prototype,
5 | // Oliver Steele's Functional, and John Resig's Micro-Templating.
6 | // For all details and documentation:
7 | // http://documentcloud.github.com/underscore
8 |
9 | (function() {
10 |
11 | // Baseline setup
12 | // --------------
13 |
14 | // Establish the root object, `window` in the browser, or `global` on the server.
15 | var root = this;
16 |
17 | // Save the previous value of the `_` variable.
18 | var previousUnderscore = root._;
19 |
20 | // Establish the object that gets returned to break out of a loop iteration.
21 | var breaker = {};
22 |
23 | // Save bytes in the minified (but not gzipped) version:
24 | var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;
25 |
26 | // Create quick reference variables for speed access to core prototypes.
27 | var slice = ArrayProto.slice,
28 | unshift = ArrayProto.unshift,
29 | toString = ObjProto.toString,
30 | hasOwnProperty = ObjProto.hasOwnProperty;
31 |
32 | // All **ECMAScript 5** native function implementations that we hope to use
33 | // are declared here.
34 | var
35 | nativeForEach = ArrayProto.forEach,
36 | nativeMap = ArrayProto.map,
37 | nativeReduce = ArrayProto.reduce,
38 | nativeReduceRight = ArrayProto.reduceRight,
39 | nativeFilter = ArrayProto.filter,
40 | nativeEvery = ArrayProto.every,
41 | nativeSome = ArrayProto.some,
42 | nativeIndexOf = ArrayProto.indexOf,
43 | nativeLastIndexOf = ArrayProto.lastIndexOf,
44 | nativeIsArray = Array.isArray,
45 | nativeKeys = Object.keys,
46 | nativeBind = FuncProto.bind;
47 |
48 | // Create a safe reference to the Underscore object for use below.
49 | var _ = function(obj) { return new wrapper(obj); };
50 |
51 | // Export the Underscore object for **Node.js**, with
52 | // backwards-compatibility for the old `require()` API. If we're in
53 | // the browser, add `_` as a global object via a string identifier,
54 | // for Closure Compiler "advanced" mode.
55 | if (typeof exports !== 'undefined') {
56 | if (typeof module !== 'undefined' && module.exports) {
57 | exports = module.exports = _;
58 | }
59 | exports._ = _;
60 | } else {
61 | root['_'] = _;
62 | }
63 |
64 | // Current version.
65 | _.VERSION = '1.3.1';
66 |
67 | // Collection Functions
68 | // --------------------
69 |
70 | // The cornerstone, an `each` implementation, aka `forEach`.
71 | // Handles objects with the built-in `forEach`, arrays, and raw objects.
72 | // Delegates to **ECMAScript 5**'s native `forEach` if available.
73 | var each = _.each = _.forEach = function(obj, iterator, context) {
74 | if (obj == null) return;
75 | if (nativeForEach && obj.forEach === nativeForEach) {
76 | obj.forEach(iterator, context);
77 | } else if (obj.length === +obj.length) {
78 | for (var i = 0, l = obj.length; i < l; i++) {
79 | if (i in obj && iterator.call(context, obj[i], i, obj) === breaker) return;
80 | }
81 | } else {
82 | for (var key in obj) {
83 | if (_.has(obj, key)) {
84 | if (iterator.call(context, obj[key], key, obj) === breaker) return;
85 | }
86 | }
87 | }
88 | };
89 |
90 | // Return the results of applying the iterator to each element.
91 | // Delegates to **ECMAScript 5**'s native `map` if available.
92 | _.map = _.collect = function(obj, iterator, context) {
93 | var results = [];
94 | if (obj == null) return results;
95 | if (nativeMap && obj.map === nativeMap) return obj.map(iterator, context);
96 | each(obj, function(value, index, list) {
97 | results[results.length] = iterator.call(context, value, index, list);
98 | });
99 | if (obj.length === +obj.length) results.length = obj.length;
100 | return results;
101 | };
102 |
103 | // **Reduce** builds up a single result from a list of values, aka `inject`,
104 | // or `foldl`. Delegates to **ECMAScript 5**'s native `reduce` if available.
105 | _.reduce = _.foldl = _.inject = function(obj, iterator, memo, context) {
106 | var initial = arguments.length > 2;
107 | if (obj == null) obj = [];
108 | if (nativeReduce && obj.reduce === nativeReduce) {
109 | if (context) iterator = _.bind(iterator, context);
110 | return initial ? obj.reduce(iterator, memo) : obj.reduce(iterator);
111 | }
112 | each(obj, function(value, index, list) {
113 | if (!initial) {
114 | memo = value;
115 | initial = true;
116 | } else {
117 | memo = iterator.call(context, memo, value, index, list);
118 | }
119 | });
120 | if (!initial) throw new TypeError('Reduce of empty array with no initial value');
121 | return memo;
122 | };
123 |
124 | // The right-associative version of reduce, also known as `foldr`.
125 | // Delegates to **ECMAScript 5**'s native `reduceRight` if available.
126 | _.reduceRight = _.foldr = function(obj, iterator, memo, context) {
127 | var initial = arguments.length > 2;
128 | if (obj == null) obj = [];
129 | if (nativeReduceRight && obj.reduceRight === nativeReduceRight) {
130 | if (context) iterator = _.bind(iterator, context);
131 | return initial ? obj.reduceRight(iterator, memo) : obj.reduceRight(iterator);
132 | }
133 | var reversed = _.toArray(obj).reverse();
134 | if (context && !initial) iterator = _.bind(iterator, context);
135 | return initial ? _.reduce(reversed, iterator, memo, context) : _.reduce(reversed, iterator);
136 | };
137 |
138 | // Return the first value which passes a truth test. Aliased as `detect`.
139 | _.find = _.detect = function(obj, iterator, context) {
140 | var result;
141 | any(obj, function(value, index, list) {
142 | if (iterator.call(context, value, index, list)) {
143 | result = value;
144 | return true;
145 | }
146 | });
147 | return result;
148 | };
149 |
150 | // Return all the elements that pass a truth test.
151 | // Delegates to **ECMAScript 5**'s native `filter` if available.
152 | // Aliased as `select`.
153 | _.filter = _.select = function(obj, iterator, context) {
154 | var results = [];
155 | if (obj == null) return results;
156 | if (nativeFilter && obj.filter === nativeFilter) return obj.filter(iterator, context);
157 | each(obj, function(value, index, list) {
158 | if (iterator.call(context, value, index, list)) results[results.length] = value;
159 | });
160 | return results;
161 | };
162 |
163 | // Return all the elements for which a truth test fails.
164 | _.reject = function(obj, iterator, context) {
165 | var results = [];
166 | if (obj == null) return results;
167 | each(obj, function(value, index, list) {
168 | if (!iterator.call(context, value, index, list)) results[results.length] = value;
169 | });
170 | return results;
171 | };
172 |
173 | // Determine whether all of the elements match a truth test.
174 | // Delegates to **ECMAScript 5**'s native `every` if available.
175 | // Aliased as `all`.
176 | _.every = _.all = function(obj, iterator, context) {
177 | var result = true;
178 | if (obj == null) return result;
179 | if (nativeEvery && obj.every === nativeEvery) return obj.every(iterator, context);
180 | each(obj, function(value, index, list) {
181 | if (!(result = result && iterator.call(context, value, index, list))) return breaker;
182 | });
183 | return result;
184 | };
185 |
186 | // Determine if at least one element in the object matches a truth test.
187 | // Delegates to **ECMAScript 5**'s native `some` if available.
188 | // Aliased as `any`.
189 | var any = _.some = _.any = function(obj, iterator, context) {
190 | iterator || (iterator = _.identity);
191 | var result = false;
192 | if (obj == null) return result;
193 | if (nativeSome && obj.some === nativeSome) return obj.some(iterator, context);
194 | each(obj, function(value, index, list) {
195 | if (result || (result = iterator.call(context, value, index, list))) return breaker;
196 | });
197 | return !!result;
198 | };
199 |
200 | // Determine if a given value is included in the array or object using `===`.
201 | // Aliased as `contains`.
202 | _.include = _.contains = function(obj, target) {
203 | var found = false;
204 | if (obj == null) return found;
205 | if (nativeIndexOf && obj.indexOf === nativeIndexOf) return obj.indexOf(target) != -1;
206 | found = any(obj, function(value) {
207 | return value === target;
208 | });
209 | return found;
210 | };
211 |
212 | // Invoke a method (with arguments) on every item in a collection.
213 | _.invoke = function(obj, method) {
214 | var args = slice.call(arguments, 2);
215 | return _.map(obj, function(value) {
216 | return (_.isFunction(method) ? method || value : value[method]).apply(value, args);
217 | });
218 | };
219 |
220 | // Convenience version of a common use case of `map`: fetching a property.
221 | _.pluck = function(obj, key) {
222 | return _.map(obj, function(value){ return value[key]; });
223 | };
224 |
225 | // Return the maximum element or (element-based computation).
226 | _.max = function(obj, iterator, context) {
227 | if (!iterator && _.isArray(obj)) return Math.max.apply(Math, obj);
228 | if (!iterator && _.isEmpty(obj)) return -Infinity;
229 | var result = {computed : -Infinity};
230 | each(obj, function(value, index, list) {
231 | var computed = iterator ? iterator.call(context, value, index, list) : value;
232 | computed >= result.computed && (result = {value : value, computed : computed});
233 | });
234 | return result.value;
235 | };
236 |
237 | // Return the minimum element (or element-based computation).
238 | _.min = function(obj, iterator, context) {
239 | if (!iterator && _.isArray(obj)) return Math.min.apply(Math, obj);
240 | if (!iterator && _.isEmpty(obj)) return Infinity;
241 | var result = {computed : Infinity};
242 | each(obj, function(value, index, list) {
243 | var computed = iterator ? iterator.call(context, value, index, list) : value;
244 | computed < result.computed && (result = {value : value, computed : computed});
245 | });
246 | return result.value;
247 | };
248 |
249 | // Shuffle an array.
250 | _.shuffle = function(obj) {
251 | var shuffled = [], rand;
252 | each(obj, function(value, index, list) {
253 | if (index == 0) {
254 | shuffled[0] = value;
255 | } else {
256 | rand = Math.floor(Math.random() * (index + 1));
257 | shuffled[index] = shuffled[rand];
258 | shuffled[rand] = value;
259 | }
260 | });
261 | return shuffled;
262 | };
263 |
264 | // Sort the object's values by a criterion produced by an iterator.
265 | _.sortBy = function(obj, iterator, context) {
266 | return _.pluck(_.map(obj, function(value, index, list) {
267 | return {
268 | value : value,
269 | criteria : iterator.call(context, value, index, list)
270 | };
271 | }).sort(function(left, right) {
272 | var a = left.criteria, b = right.criteria;
273 | return a < b ? -1 : a > b ? 1 : 0;
274 | }), 'value');
275 | };
276 |
277 | // Groups the object's values by a criterion. Pass either a string attribute
278 | // to group by, or a function that returns the criterion.
279 | _.groupBy = function(obj, val) {
280 | var result = {};
281 | var iterator = _.isFunction(val) ? val : function(obj) { return obj[val]; };
282 | each(obj, function(value, index) {
283 | var key = iterator(value, index);
284 | (result[key] || (result[key] = [])).push(value);
285 | });
286 | return result;
287 | };
288 |
289 | // Use a comparator function to figure out at what index an object should
290 | // be inserted so as to maintain order. Uses binary search.
291 | _.sortedIndex = function(array, obj, iterator) {
292 | iterator || (iterator = _.identity);
293 | var low = 0, high = array.length;
294 | while (low < high) {
295 | var mid = (low + high) >> 1;
296 | iterator(array[mid]) < iterator(obj) ? low = mid + 1 : high = mid;
297 | }
298 | return low;
299 | };
300 |
301 | // Safely convert anything iterable into a real, live array.
302 | _.toArray = function(iterable) {
303 | if (!iterable) return [];
304 | if (iterable.toArray) return iterable.toArray();
305 | if (_.isArray(iterable)) return slice.call(iterable);
306 | if (_.isArguments(iterable)) return slice.call(iterable);
307 | return _.values(iterable);
308 | };
309 |
310 | // Return the number of elements in an object.
311 | _.size = function(obj) {
312 | return _.toArray(obj).length;
313 | };
314 |
315 | // Array Functions
316 | // ---------------
317 |
318 | // Get the first element of an array. Passing **n** will return the first N
319 | // values in the array. Aliased as `head`. The **guard** check allows it to work
320 | // with `_.map`.
321 | _.first = _.head = function(array, n, guard) {
322 | return (n != null) && !guard ? slice.call(array, 0, n) : array[0];
323 | };
324 |
325 | // Returns everything but the last entry of the array. Especcialy useful on
326 | // the arguments object. Passing **n** will return all the values in
327 | // the array, excluding the last N. The **guard** check allows it to work with
328 | // `_.map`.
329 | _.initial = function(array, n, guard) {
330 | return slice.call(array, 0, array.length - ((n == null) || guard ? 1 : n));
331 | };
332 |
333 | // Get the last element of an array. Passing **n** will return the last N
334 | // values in the array. The **guard** check allows it to work with `_.map`.
335 | _.last = function(array, n, guard) {
336 | if ((n != null) && !guard) {
337 | return slice.call(array, Math.max(array.length - n, 0));
338 | } else {
339 | return array[array.length - 1];
340 | }
341 | };
342 |
343 | // Returns everything but the first entry of the array. Aliased as `tail`.
344 | // Especially useful on the arguments object. Passing an **index** will return
345 | // the rest of the values in the array from that index onward. The **guard**
346 | // check allows it to work with `_.map`.
347 | _.rest = _.tail = function(array, index, guard) {
348 | return slice.call(array, (index == null) || guard ? 1 : index);
349 | };
350 |
351 | // Trim out all falsy values from an array.
352 | _.compact = function(array) {
353 | return _.filter(array, function(value){ return !!value; });
354 | };
355 |
356 | // Return a completely flattened version of an array.
357 | _.flatten = function(array, shallow) {
358 | return _.reduce(array, function(memo, value) {
359 | if (_.isArray(value)) return memo.concat(shallow ? value : _.flatten(value));
360 | memo[memo.length] = value;
361 | return memo;
362 | }, []);
363 | };
364 |
365 | // Return a version of the array that does not contain the specified value(s).
366 | _.without = function(array) {
367 | return _.difference(array, slice.call(arguments, 1));
368 | };
369 |
370 | // Produce a duplicate-free version of the array. If the array has already
371 | // been sorted, you have the option of using a faster algorithm.
372 | // Aliased as `unique`.
373 | _.uniq = _.unique = function(array, isSorted, iterator) {
374 | var initial = iterator ? _.map(array, iterator) : array;
375 | var result = [];
376 | _.reduce(initial, function(memo, el, i) {
377 | if (0 == i || (isSorted === true ? _.last(memo) != el : !_.include(memo, el))) {
378 | memo[memo.length] = el;
379 | result[result.length] = array[i];
380 | }
381 | return memo;
382 | }, []);
383 | return result;
384 | };
385 |
386 | // Produce an array that contains the union: each distinct element from all of
387 | // the passed-in arrays.
388 | _.union = function() {
389 | return _.uniq(_.flatten(arguments, true));
390 | };
391 |
392 | // Produce an array that contains every item shared between all the
393 | // passed-in arrays. (Aliased as "intersect" for back-compat.)
394 | _.intersection = _.intersect = function(array) {
395 | var rest = slice.call(arguments, 1);
396 | return _.filter(_.uniq(array), function(item) {
397 | return _.every(rest, function(other) {
398 | return _.indexOf(other, item) >= 0;
399 | });
400 | });
401 | };
402 |
403 | // Take the difference between one array and a number of other arrays.
404 | // Only the elements present in just the first array will remain.
405 | _.difference = function(array) {
406 | var rest = _.flatten(slice.call(arguments, 1));
407 | return _.filter(array, function(value){ return !_.include(rest, value); });
408 | };
409 |
410 | // Zip together multiple lists into a single array -- elements that share
411 | // an index go together.
412 | _.zip = function() {
413 | var args = slice.call(arguments);
414 | var length = _.max(_.pluck(args, 'length'));
415 | var results = new Array(length);
416 | for (var i = 0; i < length; i++) results[i] = _.pluck(args, "" + i);
417 | return results;
418 | };
419 |
420 | // If the browser doesn't supply us with indexOf (I'm looking at you, **MSIE**),
421 | // we need this function. Return the position of the first occurrence of an
422 | // item in an array, or -1 if the item is not included in the array.
423 | // Delegates to **ECMAScript 5**'s native `indexOf` if available.
424 | // If the array is large and already in sort order, pass `true`
425 | // for **isSorted** to use binary search.
426 | _.indexOf = function(array, item, isSorted) {
427 | if (array == null) return -1;
428 | var i, l;
429 | if (isSorted) {
430 | i = _.sortedIndex(array, item);
431 | return array[i] === item ? i : -1;
432 | }
433 | if (nativeIndexOf && array.indexOf === nativeIndexOf) return array.indexOf(item);
434 | for (i = 0, l = array.length; i < l; i++) if (i in array && array[i] === item) return i;
435 | return -1;
436 | };
437 |
438 | // Delegates to **ECMAScript 5**'s native `lastIndexOf` if available.
439 | _.lastIndexOf = function(array, item) {
440 | if (array == null) return -1;
441 | if (nativeLastIndexOf && array.lastIndexOf === nativeLastIndexOf) return array.lastIndexOf(item);
442 | var i = array.length;
443 | while (i--) if (i in array && array[i] === item) return i;
444 | return -1;
445 | };
446 |
447 | // Generate an integer Array containing an arithmetic progression. A port of
448 | // the native Python `range()` function. See
449 | // [the Python documentation](http://docs.python.org/library/functions.html#range).
450 | _.range = function(start, stop, step) {
451 | if (arguments.length <= 1) {
452 | stop = start || 0;
453 | start = 0;
454 | }
455 | step = arguments[2] || 1;
456 |
457 | var len = Math.max(Math.ceil((stop - start) / step), 0);
458 | var idx = 0;
459 | var range = new Array(len);
460 |
461 | while(idx < len) {
462 | range[idx++] = start;
463 | start += step;
464 | }
465 |
466 | return range;
467 | };
468 |
469 | // Function (ahem) Functions
470 | // ------------------
471 |
472 | // Reusable constructor function for prototype setting.
473 | var ctor = function(){};
474 |
475 | // Create a function bound to a given object (assigning `this`, and arguments,
476 | // optionally). Binding with arguments is also known as `curry`.
477 | // Delegates to **ECMAScript 5**'s native `Function.bind` if available.
478 | // We check for `func.bind` first, to fail fast when `func` is undefined.
479 | _.bind = function bind(func, context) {
480 | var bound, args;
481 | if (func.bind === nativeBind && nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));
482 | if (!_.isFunction(func)) throw new TypeError;
483 | args = slice.call(arguments, 2);
484 | return bound = function() {
485 | if (!(this instanceof bound)) return func.apply(context, args.concat(slice.call(arguments)));
486 | ctor.prototype = func.prototype;
487 | var self = new ctor;
488 | var result = func.apply(self, args.concat(slice.call(arguments)));
489 | if (Object(result) === result) return result;
490 | return self;
491 | };
492 | };
493 |
494 | // Bind all of an object's methods to that object. Useful for ensuring that
495 | // all callbacks defined on an object belong to it.
496 | _.bindAll = function(obj) {
497 | var funcs = slice.call(arguments, 1);
498 | if (funcs.length == 0) funcs = _.functions(obj);
499 | each(funcs, function(f) { obj[f] = _.bind(obj[f], obj); });
500 | return obj;
501 | };
502 |
503 | // Memoize an expensive function by storing its results.
504 | _.memoize = function(func, hasher) {
505 | var memo = {};
506 | hasher || (hasher = _.identity);
507 | return function() {
508 | var key = hasher.apply(this, arguments);
509 | return _.has(memo, key) ? memo[key] : (memo[key] = func.apply(this, arguments));
510 | };
511 | };
512 |
513 | // Delays a function for the given number of milliseconds, and then calls
514 | // it with the arguments supplied.
515 | _.delay = function(func, wait) {
516 | var args = slice.call(arguments, 2);
517 | return setTimeout(function(){ return func.apply(func, args); }, wait);
518 | };
519 |
520 | // Defers a function, scheduling it to run after the current call stack has
521 | // cleared.
522 | _.defer = function(func) {
523 | return _.delay.apply(_, [func, 1].concat(slice.call(arguments, 1)));
524 | };
525 |
526 | // Returns a function, that, when invoked, will only be triggered at most once
527 | // during a given window of time.
528 | _.throttle = function(func, wait) {
529 | var context, args, timeout, throttling, more;
530 | var whenDone = _.debounce(function(){ more = throttling = false; }, wait);
531 | return function() {
532 | context = this; args = arguments;
533 | var later = function() {
534 | timeout = null;
535 | if (more) func.apply(context, args);
536 | whenDone();
537 | };
538 | if (!timeout) timeout = setTimeout(later, wait);
539 | if (throttling) {
540 | more = true;
541 | } else {
542 | func.apply(context, args);
543 | }
544 | whenDone();
545 | throttling = true;
546 | };
547 | };
548 |
549 | // Returns a function, that, as long as it continues to be invoked, will not
550 | // be triggered. The function will be called after it stops being called for
551 | // N milliseconds.
552 | _.debounce = function(func, wait) {
553 | var timeout;
554 | return function() {
555 | var context = this, args = arguments;
556 | var later = function() {
557 | timeout = null;
558 | func.apply(context, args);
559 | };
560 | clearTimeout(timeout);
561 | timeout = setTimeout(later, wait);
562 | };
563 | };
564 |
565 | // Returns a function that will be executed at most one time, no matter how
566 | // often you call it. Useful for lazy initialization.
567 | _.once = function(func) {
568 | var ran = false, memo;
569 | return function() {
570 | if (ran) return memo;
571 | ran = true;
572 | return memo = func.apply(this, arguments);
573 | };
574 | };
575 |
576 | // Returns the first function passed as an argument to the second,
577 | // allowing you to adjust arguments, run code before and after, and
578 | // conditionally execute the original function.
579 | _.wrap = function(func, wrapper) {
580 | return function() {
581 | var args = [func].concat(slice.call(arguments, 0));
582 | return wrapper.apply(this, args);
583 | };
584 | };
585 |
586 | // Returns a function that is the composition of a list of functions, each
587 | // consuming the return value of the function that follows.
588 | _.compose = function() {
589 | var funcs = arguments;
590 | return function() {
591 | var args = arguments;
592 | for (var i = funcs.length - 1; i >= 0; i--) {
593 | args = [funcs[i].apply(this, args)];
594 | }
595 | return args[0];
596 | };
597 | };
598 |
599 | // Returns a function that will only be executed after being called N times.
600 | _.after = function(times, func) {
601 | if (times <= 0) return func();
602 | return function() {
603 | if (--times < 1) { return func.apply(this, arguments); }
604 | };
605 | };
606 |
607 | // Object Functions
608 | // ----------------
609 |
610 | // Retrieve the names of an object's properties.
611 | // Delegates to **ECMAScript 5**'s native `Object.keys`
612 | _.keys = nativeKeys || function(obj) {
613 | if (obj !== Object(obj)) throw new TypeError('Invalid object');
614 | var keys = [];
615 | for (var key in obj) if (_.has(obj, key)) keys[keys.length] = key;
616 | return keys;
617 | };
618 |
619 | // Retrieve the values of an object's properties.
620 | _.values = function(obj) {
621 | return _.map(obj, _.identity);
622 | };
623 |
624 | // Return a sorted list of the function names available on the object.
625 | // Aliased as `methods`
626 | _.functions = _.methods = function(obj) {
627 | var names = [];
628 | for (var key in obj) {
629 | if (_.isFunction(obj[key])) names.push(key);
630 | }
631 | return names.sort();
632 | };
633 |
634 | // Extend a given object with all the properties in passed-in object(s).
635 | _.extend = function(obj) {
636 | each(slice.call(arguments, 1), function(source) {
637 | for (var prop in source) {
638 | obj[prop] = source[prop];
639 | }
640 | });
641 | return obj;
642 | };
643 |
644 | // Fill in a given object with default properties.
645 | _.defaults = function(obj) {
646 | each(slice.call(arguments, 1), function(source) {
647 | for (var prop in source) {
648 | if (obj[prop] == null) obj[prop] = source[prop];
649 | }
650 | });
651 | return obj;
652 | };
653 |
654 | // Create a (shallow-cloned) duplicate of an object.
655 | _.clone = function(obj) {
656 | if (!_.isObject(obj)) return obj;
657 | return _.isArray(obj) ? obj.slice() : _.extend({}, obj);
658 | };
659 |
660 | // Invokes interceptor with the obj, and then returns obj.
661 | // The primary purpose of this method is to "tap into" a method chain, in
662 | // order to perform operations on intermediate results within the chain.
663 | _.tap = function(obj, interceptor) {
664 | interceptor(obj);
665 | return obj;
666 | };
667 |
668 | // Internal recursive comparison function.
669 | function eq(a, b, stack) {
670 | // Identical objects are equal. `0 === -0`, but they aren't identical.
671 | // See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal.
672 | if (a === b) return a !== 0 || 1 / a == 1 / b;
673 | // A strict comparison is necessary because `null == undefined`.
674 | if (a == null || b == null) return a === b;
675 | // Unwrap any wrapped objects.
676 | if (a._chain) a = a._wrapped;
677 | if (b._chain) b = b._wrapped;
678 | // Invoke a custom `isEqual` method if one is provided.
679 | if (a.isEqual && _.isFunction(a.isEqual)) return a.isEqual(b);
680 | if (b.isEqual && _.isFunction(b.isEqual)) return b.isEqual(a);
681 | // Compare `[[Class]]` names.
682 | var className = toString.call(a);
683 | if (className != toString.call(b)) return false;
684 | switch (className) {
685 | // Strings, numbers, dates, and booleans are compared by value.
686 | case '[object String]':
687 | // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is
688 | // equivalent to `new String("5")`.
689 | return a == String(b);
690 | case '[object Number]':
691 | // `NaN`s are equivalent, but non-reflexive. An `egal` comparison is performed for
692 | // other numeric values.
693 | return a != +a ? b != +b : (a == 0 ? 1 / a == 1 / b : a == +b);
694 | case '[object Date]':
695 | case '[object Boolean]':
696 | // Coerce dates and booleans to numeric primitive values. Dates are compared by their
697 | // millisecond representations. Note that invalid dates with millisecond representations
698 | // of `NaN` are not equivalent.
699 | return +a == +b;
700 | // RegExps are compared by their source patterns and flags.
701 | case '[object RegExp]':
702 | return a.source == b.source &&
703 | a.global == b.global &&
704 | a.multiline == b.multiline &&
705 | a.ignoreCase == b.ignoreCase;
706 | }
707 | if (typeof a != 'object' || typeof b != 'object') return false;
708 | // Assume equality for cyclic structures. The algorithm for detecting cyclic
709 | // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.
710 | var length = stack.length;
711 | while (length--) {
712 | // Linear search. Performance is inversely proportional to the number of
713 | // unique nested structures.
714 | if (stack[length] == a) return true;
715 | }
716 | // Add the first object to the stack of traversed objects.
717 | stack.push(a);
718 | var size = 0, result = true;
719 | // Recursively compare objects and arrays.
720 | if (className == '[object Array]') {
721 | // Compare array lengths to determine if a deep comparison is necessary.
722 | size = a.length;
723 | result = size == b.length;
724 | if (result) {
725 | // Deep compare the contents, ignoring non-numeric properties.
726 | while (size--) {
727 | // Ensure commutative equality for sparse arrays.
728 | if (!(result = size in a == size in b && eq(a[size], b[size], stack))) break;
729 | }
730 | }
731 | } else {
732 | // Objects with different constructors are not equivalent.
733 | if ('constructor' in a != 'constructor' in b || a.constructor != b.constructor) return false;
734 | // Deep compare objects.
735 | for (var key in a) {
736 | if (_.has(a, key)) {
737 | // Count the expected number of properties.
738 | size++;
739 | // Deep compare each member.
740 | if (!(result = _.has(b, key) && eq(a[key], b[key], stack))) break;
741 | }
742 | }
743 | // Ensure that both objects contain the same number of properties.
744 | if (result) {
745 | for (key in b) {
746 | if (_.has(b, key) && !(size--)) break;
747 | }
748 | result = !size;
749 | }
750 | }
751 | // Remove the first object from the stack of traversed objects.
752 | stack.pop();
753 | return result;
754 | }
755 |
756 | // Perform a deep comparison to check if two objects are equal.
757 | _.isEqual = function(a, b) {
758 | return eq(a, b, []);
759 | };
760 |
761 | // Is a given array, string, or object empty?
762 | // An "empty" object has no enumerable own-properties.
763 | _.isEmpty = function(obj) {
764 | if (_.isArray(obj) || _.isString(obj)) return obj.length === 0;
765 | for (var key in obj) if (_.has(obj, key)) return false;
766 | return true;
767 | };
768 |
769 | // Is a given value a DOM element?
770 | _.isElement = function(obj) {
771 | return !!(obj && obj.nodeType == 1);
772 | };
773 |
774 | // Is a given value an array?
775 | // Delegates to ECMA5's native Array.isArray
776 | _.isArray = nativeIsArray || function(obj) {
777 | return toString.call(obj) == '[object Array]';
778 | };
779 |
780 | // Is a given variable an object?
781 | _.isObject = function(obj) {
782 | return obj === Object(obj);
783 | };
784 |
785 | // Is a given variable an arguments object?
786 | _.isArguments = function(obj) {
787 | return toString.call(obj) == '[object Arguments]';
788 | };
789 | if (!_.isArguments(arguments)) {
790 | _.isArguments = function(obj) {
791 | return !!(obj && _.has(obj, 'callee'));
792 | };
793 | }
794 |
795 | // Is a given value a function?
796 | _.isFunction = function(obj) {
797 | return toString.call(obj) == '[object Function]';
798 | };
799 |
800 | // Is a given value a string?
801 | _.isString = function(obj) {
802 | return toString.call(obj) == '[object String]';
803 | };
804 |
805 | // Is a given value a number?
806 | _.isNumber = function(obj) {
807 | return toString.call(obj) == '[object Number]';
808 | };
809 |
810 | // Is the given value `NaN`?
811 | _.isNaN = function(obj) {
812 | // `NaN` is the only value for which `===` is not reflexive.
813 | return obj !== obj;
814 | };
815 |
816 | // Is a given value a boolean?
817 | _.isBoolean = function(obj) {
818 | return obj === true || obj === false || toString.call(obj) == '[object Boolean]';
819 | };
820 |
821 | // Is a given value a date?
822 | _.isDate = function(obj) {
823 | return toString.call(obj) == '[object Date]';
824 | };
825 |
826 | // Is the given value a regular expression?
827 | _.isRegExp = function(obj) {
828 | return toString.call(obj) == '[object RegExp]';
829 | };
830 |
831 | // Is a given value equal to null?
832 | _.isNull = function(obj) {
833 | return obj === null;
834 | };
835 |
836 | // Is a given variable undefined?
837 | _.isUndefined = function(obj) {
838 | return obj === void 0;
839 | };
840 |
841 | // Has own property?
842 | _.has = function(obj, key) {
843 | return hasOwnProperty.call(obj, key);
844 | };
845 |
846 | // Utility Functions
847 | // -----------------
848 |
849 | // Run Underscore.js in *noConflict* mode, returning the `_` variable to its
850 | // previous owner. Returns a reference to the Underscore object.
851 | _.noConflict = function() {
852 | root._ = previousUnderscore;
853 | return this;
854 | };
855 |
856 | // Keep the identity function around for default iterators.
857 | _.identity = function(value) {
858 | return value;
859 | };
860 |
861 | // Run a function **n** times.
862 | _.times = function (n, iterator, context) {
863 | for (var i = 0; i < n; i++) iterator.call(context, i);
864 | };
865 |
866 | // Escape a string for HTML interpolation.
867 | _.escape = function(string) {
868 | return (''+string).replace(/&/g, '&').replace(//g, '>').replace(/"/g, '"').replace(/'/g, ''').replace(/\//g,'/');
869 | };
870 |
871 | // Add your own custom functions to the Underscore object, ensuring that
872 | // they're correctly added to the OOP wrapper as well.
873 | _.mixin = function(obj) {
874 | each(_.functions(obj), function(name){
875 | addToWrapper(name, _[name] = obj[name]);
876 | });
877 | };
878 |
879 | // Generate a unique integer id (unique within the entire client session).
880 | // Useful for temporary DOM ids.
881 | var idCounter = 0;
882 | _.uniqueId = function(prefix) {
883 | var id = idCounter++;
884 | return prefix ? prefix + id : id;
885 | };
886 |
887 | // By default, Underscore uses ERB-style template delimiters, change the
888 | // following template settings to use alternative delimiters.
889 | _.templateSettings = {
890 | evaluate : /<%([\s\S]+?)%>/g,
891 | interpolate : /<%=([\s\S]+?)%>/g,
892 | escape : /<%-([\s\S]+?)%>/g
893 | };
894 |
895 | // When customizing `templateSettings`, if you don't want to define an
896 | // interpolation, evaluation or escaping regex, we need one that is
897 | // guaranteed not to match.
898 | var noMatch = /.^/;
899 |
900 | // Within an interpolation, evaluation, or escaping, remove HTML escaping
901 | // that had been previously added.
902 | var unescape = function(code) {
903 | return code.replace(/\\\\/g, '\\').replace(/\\'/g, "'");
904 | };
905 |
906 | // JavaScript micro-templating, similar to John Resig's implementation.
907 | // Underscore templating handles arbitrary delimiters, preserves whitespace,
908 | // and correctly escapes quotes within interpolated code.
909 | _.template = function(str, data) {
910 | var c = _.templateSettings;
911 | var tmpl = 'var __p=[],print=function(){__p.push.apply(__p,arguments);};' +
912 | 'with(obj||{}){__p.push(\'' +
913 | str.replace(/\\/g, '\\\\')
914 | .replace(/'/g, "\\'")
915 | .replace(c.escape || noMatch, function(match, code) {
916 | return "',_.escape(" + unescape(code) + "),'";
917 | })
918 | .replace(c.interpolate || noMatch, function(match, code) {
919 | return "'," + unescape(code) + ",'";
920 | })
921 | .replace(c.evaluate || noMatch, function(match, code) {
922 | return "');" + unescape(code).replace(/[\r\n\t]/g, ' ') + ";__p.push('";
923 | })
924 | .replace(/\r/g, '\\r')
925 | .replace(/\n/g, '\\n')
926 | .replace(/\t/g, '\\t')
927 | + "');}return __p.join('');";
928 | var func = new Function('obj', '_', tmpl);
929 | if (data) return func(data, _);
930 | return function(data) {
931 | return func.call(this, data, _);
932 | };
933 | };
934 |
935 | // Add a "chain" function, which will delegate to the wrapper.
936 | _.chain = function(obj) {
937 | return _(obj).chain();
938 | };
939 |
940 | // The OOP Wrapper
941 | // ---------------
942 |
943 | // If Underscore is called as a function, it returns a wrapped object that
944 | // can be used OO-style. This wrapper holds altered versions of all the
945 | // underscore functions. Wrapped objects may be chained.
946 | var wrapper = function(obj) { this._wrapped = obj; };
947 |
948 | // Expose `wrapper.prototype` as `_.prototype`
949 | _.prototype = wrapper.prototype;
950 |
951 | // Helper function to continue chaining intermediate results.
952 | var result = function(obj, chain) {
953 | return chain ? _(obj).chain() : obj;
954 | };
955 |
956 | // A method to easily add functions to the OOP wrapper.
957 | var addToWrapper = function(name, func) {
958 | wrapper.prototype[name] = function() {
959 | var args = slice.call(arguments);
960 | unshift.call(args, this._wrapped);
961 | return result(func.apply(_, args), this._chain);
962 | };
963 | };
964 |
965 | // Add all of the Underscore functions to the wrapper object.
966 | _.mixin(_);
967 |
968 | // Add all mutator Array functions to the wrapper.
969 | each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
970 | var method = ArrayProto[name];
971 | wrapper.prototype[name] = function() {
972 | var wrapped = this._wrapped;
973 | method.apply(wrapped, arguments);
974 | var length = wrapped.length;
975 | if ((name == 'shift' || name == 'splice') && length === 0) delete wrapped[0];
976 | return result(wrapped, this._chain);
977 | };
978 | });
979 |
980 | // Add all accessor Array functions to the wrapper.
981 | each(['concat', 'join', 'slice'], function(name) {
982 | var method = ArrayProto[name];
983 | wrapper.prototype[name] = function() {
984 | return result(method.apply(this._wrapped, arguments), this._chain);
985 | };
986 | });
987 |
988 | // Start chaining a wrapped Underscore object.
989 | wrapper.prototype.chain = function() {
990 | this._chain = true;
991 | return this;
992 | };
993 |
994 | // Extracts the result from a wrapped and chained object.
995 | wrapper.prototype.value = function() {
996 | return this._wrapped;
997 | };
998 |
999 | }).call(this);
1000 |
--------------------------------------------------------------------------------