skip to main
|
skip to sidebar
Django talk
Monday, June 25, 2018
simple django application since im a beginner I'm unable to doit..
Enter Ip Address:
Search
import json
import requests
import urllib.request
import urllib.parse
import cgi
import urllib
from OTXv2 import OTXv2
from OTXv2 import IndicatorTypes
import random
# thus you will get the key word entered in search text box in searchterm variable in python.
form = cgi.FieldStorage()
searchterm = form.getvalue('searchbox')
class Virustotals():
# Asks for user input of an IP and converts to a string for passing to virustotal
global ipaddress
ipaddress = str(input('Enter an IP address to scan: \n'))
def __init__(self):
self.ipaddress = ipaddress
def scan(self):
# this code for url or ip scan
url = '
https://www.virustotal.com/vtapi/v2/url/scan
'
params = {'apikey': 'ed5da42cc5088d63845a74207562cd8655e7c4c9b09ffb6b5e739317ac664ae8', 'resource': ipaddress}
response = requests.post(url, data=params)
json_scan = response.json()
print("json_scan", json_scan)
# this code is for the gettings reports
def reports(self):
url = '
https://www.virustotal.com/vtapi/v2/ip-address/report
'
parameters = {'apikey': 'ed5da42cc5088d63845a74207562cd8655e7c4c9b09ffb6b5e739317ac664ae8','ip': ipaddress}
response = urllib.request.urlopen('%s?%s' % (url, urllib.parse.urlencode(parameters))).read()
response_scan = json.loads(response)
# response = requests.post('
https://www.virustotal.com/vtapi/v2/url/report
', params=params, headers=headers)
# response_dict = response.json
print("response_dict", response_scan)
# harvest important info from JSON response
positiveresults = 0
totalresults = 0
try:
for x in response_scan.get("detected_referrer_samples"):
positiveresults = positiveresults + x.get("positives")
totalresults = totalresults + x.get("total")
except Exception as error:
# if no results found program throws a TypeError
print("No results {}".format(error))
# convert results to string for output formatting
positiveresults = str(positiveresults)
totalresults = str(totalresults)
# print results
print(positiveresults + '/' + totalresults + ' total AV detection ratio')
class Otx(Virustotals):
def __init__(self):
self.ipaddress = ipaddress
def scan_otx(self):
# Your API key
key = '0f9b19c83d936456e271956d4b4ee9d2561889edd32c07deda1100836ad9eba8'
otx = OTXv2(random.choice(key))
# key = self.otxKeys.put('0f9b19c83d936456e271956d4b4ee9d2561889edd32c07deda1100836ad9eba8')
section_details = otx.get_indicator_details_full(IndicatorTypes.IPv4, self.ipaddress)
otxresult = json.dumps(section_details)
print('otxresult', otxresult)
# rep = otx.get_indicator_details_by_section(IndicatorTypes.IPv4, line , section='reputation')
mal = otx.get_indicator_details_by_section(IndicatorTypes.IPv4, self.ipaddress, section='malware')
# print('rep',rep)
print("mal", mal)
print(json.dumps(mal, sort_keys=True, indent=4))
# otx = OTXv2(API_KEY, server=OTX_SERVER)
if __name__ == '__main__':
d = Virustotals()
d.scan()
d.reports()
o = Otx()
o.scan_otx()
I want to know the IP is malicious or not by simple web application since I'm a beginner I unable to do it. help me
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
django-users+unsubscribe@googlegroups.com
.
To post to this group, send email to
django-users@googlegroups.com
.
Visit this group at
https://groups.google.com/group/django-users
.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/40926567-952b-449b-85b2-e7e91ab86b82%40googlegroups.com
.
For more options, visit
https://groups.google.com/d/optout
.
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
Followers
Blog Archive
►
2026
(4)
►
January
(4)
►
2025
(88)
►
November
(2)
►
October
(4)
►
September
(1)
►
July
(1)
►
June
(4)
►
May
(5)
►
April
(8)
►
March
(5)
►
February
(17)
►
January
(41)
►
2024
(915)
►
December
(109)
►
November
(73)
►
October
(139)
►
September
(132)
►
August
(19)
►
July
(19)
►
June
(7)
►
May
(7)
►
April
(6)
►
March
(117)
►
February
(285)
►
January
(2)
►
2023
(624)
►
November
(11)
►
October
(52)
►
September
(14)
►
August
(35)
►
July
(55)
►
June
(54)
►
May
(134)
►
April
(114)
►
March
(122)
►
February
(9)
►
January
(24)
►
2022
(1775)
►
December
(61)
►
November
(273)
►
October
(216)
►
September
(393)
►
August
(274)
►
July
(169)
►
June
(32)
►
May
(7)
►
April
(6)
►
March
(24)
►
February
(173)
►
January
(147)
►
2021
(2886)
►
December
(60)
►
November
(27)
►
October
(45)
►
September
(24)
►
August
(31)
►
July
(193)
►
June
(603)
►
May
(442)
►
April
(387)
►
March
(435)
►
February
(348)
►
January
(291)
►
2020
(7609)
►
December
(465)
►
November
(218)
►
October
(420)
►
September
(546)
►
August
(593)
►
July
(659)
►
June
(759)
►
May
(1010)
►
April
(702)
►
March
(701)
►
February
(873)
►
January
(663)
►
2019
(7763)
►
December
(562)
►
November
(638)
►
October
(612)
►
September
(633)
►
August
(651)
►
July
(604)
►
June
(635)
►
May
(744)
►
April
(714)
►
March
(682)
►
February
(600)
►
January
(688)
▼
2018
(7433)
►
December
(464)
►
November
(772)
►
October
(705)
►
September
(518)
►
August
(752)
►
July
(720)
▼
June
(609)
Re: Django production deployment on my VPS
Django production deployment on my VPS
Re: Database
Re: Database
Re: Database
Cannot add choice filed with radio buttons in my m...
Re: django windows apache tell if apache is working
Re: django windows apache tell if apache is working
Re: Queryset calculation and then filter/exclude/l...
Re: django windows apache tell if apache is working
Re: Can't access my django runserver
Re: Can't access my django runserver
Re: Can't access my django runserver
Re: Can't access my django runserver
Database
django windows apache tell if apache is working
Re: django.contrib.admin
Re: Django Admin
django.contrib.admin
Re: Queryset calculation and then filter/exclude/l...
Django Admin
how to programmatically get the index name of a mo...
Re: Django split screen
Re: Using React Native
Re: Django split screen
Django split screen
Re: NoReverseMatch at / ' homepage' is not a regis...
Re: NoReverseMatch at / ' homepage' is not a regis...
Re: django
Re: Using React Native
django
Re: Can't access my django runserver
Re: Using React Native
Re: Tutorial help Blank Front page
Using React Native
Re: Can't access my django runserver
Re: Queryset calculation and then filter/exclude/l...
Re: Newbie : Object copy - weird error :-)
Re: Newbie : Object copy - weird error :-)
Re: Django dev server issue
Django log error email configuration?
Re: Isolated virtualenv and mod_wsgi - how do I do...
Re: Django's cache framework problem
Re: Isolated virtualenv and mod_wsgi - how do I do...
Isolated virtualenv and mod_wsgi - how do I do thi...
Re: Templates html error
Templates html error
Re: Beginner
Re: Django's cache framework problem
Re: Django's cache framework problem
Re: Django's cache framework problem
Re: better way to create a dictionary in Django mo...
Re: Django's cache framework problem
Re: Django's cache framework problem
Queryset calculation and then filter/exclude/limit...
Re: Invalid URLs passing validation by URLValidator
Re: Invalid URLs passing validation by URLValidator
Beginner
Re: Admin site not working properly using passenge...
Re: Deploy on Heroku
Re:
Re: better way to create a dictionary in Django mo...
Re: Why do we need @cached_property behave like pr...
Why do we need @cached_property behave like proper...
Re: better way to create a dictionary in Django mo...
What is the best way of sending email message to a...
Re: better way to create a dictionary in Django mo...
Re: better way to create a dictionary in Django mo...
Re: Django's cache framework problem
Re: Newbie : Object copy - weird error :-)
Re: Deploy on Heroku
better way to create a dictionary in Django model?
Deploy on Heroku
Re: Can't access my django runserver
Can't access my django runserver
Re: simple django application since im a beginner ...
Django's cache framework problem
Re: NoReverseMatch at / ' homepage' is not a regis...
Re: Websocket connection failed: Error during WebS...
Using Django admin datepicker in a custom form
Re: Websocket connection failed: Error during WebS...
Re: Websocket connection failed: Error during WebS...
Re: Newbie : Object copy - weird error :-)
Re: Forms in Bootstrap 4 Modals?
Re: Websocket connection failed: Error during WebS...
Re: django display a row vale
Re: django display a row vale
Re: NoReverseMatch at / ' homepage' is not a regis...
Re: Importing classes from one app to another in a...
Re: Where setting up templates directory in settin...
Re: Newbie : Object copy - weird error :-)
Newbie : Object copy - weird error :-)
Importing classes from one app to another in a pro...
Re: Where setting up templates directory in settin...
Re: Newbie : Object copy - weird error :-)
Re: Djnago Python (INNER JOIN Query Or JOIN Query)
Djnago Python (INNER JOIN Query Or JOIN Query)
Where setting up templates directory in settings.py
Newbie : Object copy - weird error :-)
Newbie : Implementation possible ?
►
May
(691)
►
April
(488)
►
March
(492)
►
February
(488)
►
January
(734)
►
2017
(5842)
►
December
(509)
►
November
(470)
►
October
(343)
►
September
(474)
►
August
(436)
►
July
(393)
►
June
(504)
►
May
(617)
►
April
(506)
►
March
(553)
►
February
(494)
►
January
(543)
►
2016
(5793)
►
December
(439)
►
November
(406)
►
October
(376)
►
September
(347)
►
August
(653)
►
July
(489)
►
June
(446)
►
May
(496)
►
April
(513)
►
March
(454)
►
February
(666)
►
January
(508)
►
2015
(7015)
►
December
(413)
►
November
(525)
►
October
(475)
►
September
(455)
►
August
(551)
►
July
(596)
►
June
(530)
►
May
(630)
►
April
(639)
►
March
(789)
►
February
(602)
►
January
(810)
►
2014
(8097)
►
December
(702)
►
November
(789)
►
October
(753)
►
September
(740)
►
August
(759)
►
July
(704)
►
June
(631)
►
May
(754)
►
April
(529)
►
March
(537)
►
February
(580)
►
January
(619)
►
2013
(10100)
►
December
(516)
►
November
(635)
►
October
(836)
►
September
(742)
►
August
(862)
►
July
(939)
►
June
(848)
►
May
(967)
►
April
(990)
►
March
(984)
►
February
(862)
►
January
(919)
►
2012
(12829)
►
December
(824)
►
November
(874)
►
October
(980)
►
September
(1063)
►
August
(1032)
►
July
(1122)
►
June
(1109)
►
May
(1254)
►
April
(1201)
►
March
(1189)
►
February
(1133)
►
January
(1048)
►
2011
(14283)
►
December
(872)
►
November
(1050)
►
October
(1125)
►
September
(1004)
►
August
(1316)
►
July
(1292)
►
June
(1275)
►
May
(1261)
►
April
(1157)
►
March
(1375)
►
February
(1232)
►
January
(1324)
►
2010
(9629)
►
December
(1175)
►
November
(1257)
►
October
(1215)
►
September
(1287)
►
August
(1393)
►
July
(1348)
►
June
(1382)
►
May
(572)
About Me
faw
View my complete profile
No comments:
Post a Comment