GithubHelp home page GithubHelp logo

rshipp / python-dshield Goto Github PK

View Code? Open in Web Editor NEW
23.0 4.0 13.0 49 KB

Pythonic interface to the Internet Storm Center / DShield API.

Home Page: https://dshield.readthedocs.io/en/latest/

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%
python library dshield sans isc security infosec api-client

python-dshield's Introduction

DShield

Build Status

Test Coverage

Code Health

PyPi Version

A Pythonic interface to the Internet Storm Center / DShield API.

Installation

pip install dshield

Usage

For the full documentation, see the ReadTheDocs site. If you just want a quick start:

>>> import dshield
>>> dshield.infocon()
{'status': 'green'}
>>> dshield.infocon(dshield.XML)
'<?xml version="1.0" encoding="UTF-8"?>\n<infocon>\n<status>green</status>\n</infocon>'

python-dshield's People

Contributors

rshipp avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

python-dshield's Issues

Install stuck

installation is stuck at processing triggers for menu...

see attachment

image

only error is "pip: not found"

Errors in topips()

I use pip install dshield then ran:

>>> import dshield
>>> print(dshield.topips())

This is the error in 2.7:

>>> import dshield
>>> print(dshield.topips())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/my/path/here/lib/python2.7/site-packages/dshield.py", line 157, in topips
    return _get(uri, return_format)
  File "/my/path/here/lib/python2.7/site-packages/dshield.py", line 35, in _get
    return _strip_and_reformat(requests.get(''.join([__BASE_URL, function, JSON])).json())
  File "/my/path/here/lib/python2.7/site-packages/dshield.py", line 21, in _strip_and_reformat
    data_copy = data.copy()
AttributeError: 'list' object has no attribute 'copy'

I fixed this by adding be below snippt at line 21:

    if type(data) == dict:
        data_copy = data.copy()
    elif type(data) == list:
        data_copy = list(data)

to maintain the shallow copy. I also added TypeError to the execptions on line 25 of dshield.py.

This is the error in 3.5:

>>> import dshield
>>> print(dshield.topips())
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/my/path/here/lib/python3.5/site-packages/dshield.py", line 157, in topips
    return _get(uri, return_format)
  File "/my/path/here/lib/python3.5/site-packages/dshield.py", line 35, in _get
    return _strip_and_reformat(requests.get(''.join([__BASE_URL, function, JSON])).json())
  File "/my/path/here/lib/python3.5/site-packages/dshield.py", line 23, in _strip_and_reformat
    data_copy.__delitem__('METAKEYINFO')
TypeError: list indices must be integers or slices, not str

I remedied this by adding AttributeError to the execptions on line 25 of dshield.py.

Am I using this incorrectly or is this a current bug? If it's a bug I'm happy to make a PR.

topips() not using the passed limit

If I run:

import dshield
ips = dshield.topips(limit=100)
print(len(ips))

The expected output is 100. The output every time is 10. The api supports limits up to 1000 I believe.

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.