from smb.SMBConnection import SMBConnection

conn = SMBConnection(userid="", password="", client_machine_name="", servername="", 

                                domain="",use_ntlm_v2=True, is_direct_tcp=True)
conn.connect(serverip = "", 445)
shares = conn.listShares()

for share in shares:
      if not share.isSpecial and share.name not in ['NETLOGON', 'SYSVOL']:
            print("share name :" + share.name)
            sharedfiles = conn.listPath(share.name,'/')
            for sharedfile in sharedfiles:
                  print(sharedfile.filename)
                  conn.close()

'Python' 카테고리의 다른 글

Getting snmp informations with python script  (0) 2020.04.22
USING THREAD IN PYTHON  (0) 2020.04.07
CRAWLING WITH PYTHON  (0) 2020.04.07
TRY TO CONNECT VIA MYSQL  (0) 2020.04.07
TRY TO TEST FOR DEFAULT ACCOUNT VIA TELNET  (0) 2020.04.07
import pymysql

ratency = 2
conn = pymysql.connect(host="", user="", password="", read_timeout=ratency, write_timeout=ratency)

if conn.open == True:

     curs = conn.cursor()
     command = "show databases"
     curs.execute(command)
     rows = curs.fetchall()
     print(rows)
     conn.close()
     
''' case of using Dict type
cursor = conn.cursor(pymysql.cursors.DictCursor)
sql = 'select * from some_talbe'
cursor.execute(sql)
result = cursor.fetchall()
print(result)
'''
     
else:
      print("can not connected")

'Python' 카테고리의 다른 글

Getting snmp informations with python script  (0) 2020.04.22
USING THREAD IN PYTHON  (0) 2020.04.07
CRAWLING WITH PYTHON  (0) 2020.04.07
TRY TO CONNECT VIA SMB OR CIFS  (0) 2020.04.07
TRY TO TEST FOR DEFAULT ACCOUNT VIA TELNET  (0) 2020.04.07

+ Recent posts