import smbclient

def scan_smb_server(server, username, password):
    files_dict = {}
    with smbclient.SambaClient(server, username=username, password=password) as client:
        for entry in client.listdir(''):
            if client.isdir(entry):
                for root, dirs, files in client.walk(entry):
                    for f in files:
                        file_path = root + '/' + f
                        files_dict[file_path] = f
            else:
                files_dict[entry] = entry
    return files_dict

# Example usage
files = scan_smb_server('smb://myserver/myshare', 'myusername', 'mypassword')
print(files)

- 토큰값은 telegram 내 botfather 채널을 통해 봇생성후 발급

- 토큰ID는 해당 봇을 초대한 방의 ID 인데 Get My ID 를 초대하여 발급

 

 

import telegram
 
telegram_token = '5978653330:AAFBbq5TzOVT2ARdUK61dSI0pZl7P8FPxZU'
telegram_id = -676063172
 

def send_telegram_message(message):
    try:
        bot = telegram.Bot(telegram_token)
        res = bot.sendMessage(chat_id=telegram_id, text=message)
 
        return res
 
    except Exception:
        raise

send_telegram_message('EmergingThreat Blacklist IP ''{{vars.Attacker_ip}}''  12시간 차단(Qurantine)하였습니다.')

import json

data = """
{
    "devname": "FAC3KE3R16000005",       
    "devid": "FAC3KE3R16000005",
    "vd": "root",
    "faclogindex": "38867",
    "logid": "10001",
    "logdesc": "GUI_ENTRY_ADDITION",     
    "type": "event",
    "subtype": "Admin",
    "level": "information",
    "user": "admin",
    "action": "Add",
    "msg": "Added Local User: siemtest3",
    "tz": "+0900"
}
"""

# Load JSON data
json_data = json.loads(data)

# Find key that contains the string "GUI" in its value
key_with_gui = None
for key, value in json_data.items():
    if 'GUI' in value:
        key_with_gui = key
        break

if key_with_gui:
    print("The key that contains the string 'GUI' in its value is:", key_with_gui)
else:
    print("No key contains the string 'GUI' in its value.")

+ Recent posts