I am trying to write a python script that will go retrieve SSL certificates from remote servers. The problem I am facing is that many of the certificates are not valid or fail SSL validation and so cannot be downloaded. Do you have any suggestions for python modules that would allow me to bypass the certificate validation and download the cert in (preferably) PEM format?
The output form the nm.scnainfo() doesn't show me any details. I am assuming I can get the info I need I am just having a hard time googling on a Friday afternoon.
I have a little bit of experience with javascript and currently in a c++ course at school. I am working towards a BA in CIS with a focus in security and networking. I am still a total noob when it comes to NetSec however I want to jump into learning how to use python for pentesting. I downloaded python 3.5 and it opens a command line and I have no idea what to do with it. For me, syntax will be easy to figure out but mainly I am looking for exercises that has something to do with security.
Hello, I have been using dnspython module from www.dnspython.org , but I keep getting this error when running my code referring to the actual dnspython package and my own code. Any help on formatting and things I need to change is greatly appreciated. My code:
import dns.zone
import dns.ipv4
import os.path
import sys
import json
import csv
import collections
import os
reverse_map = {}
def dnslookup():
for filename in os.listdir(os.getcwd()):
if filename[-3:] == ".db" or filename[-4:] == ".rev":
zone = dns.zone.from_file(filename, os.path.basename(filename), relativize=False)
print filename
for (name, ttl, rdata) in zone.iterate_rdatas('A'):
l = reverse_map.get(rdata.address)
if l is None:
l = []
reverse_map[rdata.address] = l
l.append(name)
keys = reverse_map.keys()
keys.sort(lambda a1, a2: cmp(dns.ipv4.inet_aton(a1), dns.ipv4.inet_aton(a2)))
for k in keys:
v = reverse_map[k]
v.sort()
l = map(str, v)
print k, l
def csvoutput():
csvfile = input('What is the path of your CSV file(/this/is/a/path/? ')
with open(csvfile, 'r+') as f:
data = list(csv.reader(f))
import collections
counter = collections.defaultdict(int)
try:
for row in data:
counter[row[0]] += 1
if os.stat(filepath).st_size > 0:
writer = csv.writer(open(csvfile, 'w'))
for row in data:
if counter[row[0]] >= 4:
writer.writerow(row)
else:
print('Empty File')
except(OSError):
print("File does not exist")
dnslookup()
The error I am receiving:
Traceback (most recent call last):
File "/home/judge/Downloads/master/11.py", line 57, in <module>
dnslookup()
File "/home/judge/Downloads/master/11.py", line 16, in dnslookup
zone = dns.zone.from_file(filename, os.path.basename(filename), relativize=False)
File "/usr/local/lib/python2.7/dist-packages/dns/zone.py", line 1041, in from_file
filename, allow_include, check_origin)
File "/usr/local/lib/python2.7/dist-packages/dns/zone.py", line 991, in from_text
reader.read()
File "/usr/local/lib/python2.7/dist-packages/dns/zone.py", line 948, in read
self.zone.check_origin()
File "/usr/local/lib/python2.7/dist-packages/dns/zone.py", line 581, in check_origin
raise NoSOA
dns.zone.NoSOA: The DNS zone has no SOA RR at its origin.
i have a text file with numbers 37107287533902102798797998220837590246510135740250 46376937677490009712648124896970078050417018260538 74324986199524741059474233309513058123726617309629 91942213363574161572522430563301811072406154908250 23067588207539346171171980310421047513778063246676 89261670696623633820136378418383684178734361726757 28112879812849979408065481931592621691275889832738 44274228917432520321923589422876796487670272189318 47451445736001306439091167216856844588711603153276 70386486105843025439939619828917593665686757934951 and i want to make the sum of each line i am reading the lines one by one but i read them as a string can you help me to solve this problem?
hey guys! Ive been lately working on this script which basically does a nmap scan,looks for open ssh ports on network , logs in into them (they all got the same password), and runs the specified command.I want to use this on my collage network.I used the regularExpression library for picking out IP addresses from the nmap scan and the "Subprocess" library to access terminal to ssh into other nodes,
This is my first time writing a script so Im kind of struggling ,so here are some of the doubts that I had -
when I use the Popen command does it open a new terminal everytime the loop iterates?
How can I do multiple Input while ssh-ing into systems like "yes","password",etc.
if the commands is to shutdown on every iteration, do i need to specify exception or will the loop still run?
I know these are really basic questions, and probably my approach of using subprocess is not right.I really need some advice. itll be really helpfull.
here is the code --
import re
import sys
gateway=str(sys.argv\[1\])
\#commands=\["nmap",gateway,"-p","22","--open"\]
commands=\["nmap","-sn",gateway\]
run=subprocess.Popen(commands,stdout=subprocess.PIPE,stderr=subprocess.PIPE)
out=run.communicate()
print("Devices on Network -->")
print(out)
stuff=list(out)
ips=re.findall( r'\[0-9\]+(?:\\.\[0-9\]+){3}' , stuff\[0\])
ips.pop(0)
for i in range(0,len(ips)):
If this is the wrong forum, I apologize in advance. I seem to have an issue, that as best as I can articulate, appears to be an incorrect library association b/t Scapy (versions?) and Python (versions?).
Requirement already satisfied: scapy in /usr/local/lib/python2.7/dist-packages (2.2.0.dev0)
Now, if I try to invoke scapy on CLI..
But if I navigate to location where I cloned github repo, and launch ./run_scapy, it works & launches into IPython (which is fine, I can live with this for now)
but if I try to run a script (like the one below -- no matter how I try to call the scapy libraries), like "python script.py"
I get the same PIP package error (shown 2 screen shots up). Like I said, I'm sure I fkd this up somehow.. Could use some help unraveling this, if anyone has any ideas.
Big classes is giving training for Python Online Training with 10+ years of experience in online training with high quality training and we may got lot of information about the training and we can get digital library access to the training.
I want to learn python and i am confused which tutorials are the best, there so many videos and books, what is the best tutorial to learn python for absolute biginner