好用的python3脚本 识别Windows环境下的WIFI连接历史记录(不需要安装模块) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 import subprocessdef get_previous_networks (): networks = [] try : result = subprocess.run(['netsh' , 'wlan' , 'show' , 'profiles' ], capture_output=True , text=True ) output_lines = result.stdout.splitlines() for line in output_lines: if "所有用户配置文件" in line: ssid = line.split(":" )[1 ].strip() networks.append(ssid) except Exception as e: print ("获取历史无线网络失败:" , e) return networks networks = get_previous_networks()print ("历史上连接过的无线网络:" )for network in networks: print (network)
图片定位,调用高德地图API(需原始图片,GPS信息未被抹除) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 import requestsimport exifreaddef get_geolocation_from_image (image_path ): with open (image_path, 'rb' ) as image_file: tags = exifread.process_file(image_file) if 'GPS GPSLatitude' in tags and 'GPS GPSLongitude' in tags: latitude = tags['GPS GPSLatitude' ] longitude = tags['GPS GPSLongitude' ] lat_ref = str (tags['GPS GPSLatitudeRef' ]) lng_ref = str (tags['GPS GPSLongitudeRef' ]) lat_degrees = latitude.values[0 ].num / latitude.values[0 ].den lat_minutes = latitude.values[1 ].num / latitude.values[1 ].den lat_seconds = latitude.values[2 ].num / latitude.values[2 ].den lng_degrees = longitude.values[0 ].num / longitude.values[0 ].den lng_minutes = longitude.values[1 ].num / longitude.values[1 ].den lng_seconds = longitude.values[2 ].num / longitude.values[2 ].den lat_decimal_degrees = lat_degrees + lat_minutes / 60 + lat_seconds / 3600 lng_decimal_degrees = lng_degrees + lng_minutes / 60 + lng_seconds / 3600 if lat_ref == 'S' : lat_decimal_degrees = -lat_decimal_degrees if lng_ref == 'W' : lng_decimal_degrees = -lng_decimal_degrees return lat_decimal_degrees, lng_decimal_degrees else : return None def geocode_analysis (lat, lng, api_key ): url = f'https://restapi.amap.com/v3/geocode/regeo?location={lng} ,{lat} &key={api_key} &output=json' response = requests.get(url) data = response.json() if data['status' ] == '1' and data['info' ] == 'OK' : address = data['regeocode' ]['formatted_address' ] print (f'经度: {lng} , 纬度: {lat} ' ) print (f'地址: {address} ' ) else : print ('无法获取地址信息' )if __name__ == '__main__' : api_key = '高德api调用' image_path = '图片路径' geolocation = get_geolocation_from_image(image_path) if geolocation: latitude, longitude = geolocation geocode_analysis(latitude, longitude, api_key) else : print ('无法获取' )
隐写:基础的PNG图片高度宽度恢复脚本 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 import binasciiimport structwith open ('高度宽度损坏图片路径' , 'rb' ) as file: modified_data = file.read() crcbp = open ("F:\\.vscode\\class.py\\2.png" , "rb" ).read() crc32frombp = int (crcbp[29 :33 ].hex (), 16 ) print ('crc:' , crc32frombp) found_solution = False for height in range (4000 ): for width in range (4000 ): data = crcbp[12 :16 ] + \ struct.pack('>i' , height) + struct.pack('>i' , width) + crcbp[24 :29 ] crc32 = binascii.crc32(data) & 0xffffffff if crc32 == crc32frombp: data_start = modified_data.find(b'\x49\x44\x41\x54' ) modified_image_data = modified_data[data_start:] with open ('修复后的图片存放路径' , 'wb' ) as file: file.write(crcbp[:16 ]) file.write(struct.pack('!I' , height)) file.write(struct.pack('!I' , width)) file.write(crcbp[24 :data_start]) file.write(modified_image_data) print ("图片还原完成!原始图片的高度为:" , height, "宽度为:" , width) found_solution = True break if found_solution: break
提取json文件中的question属性 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 import jsonimport pandas as pddef extract_questions_from_json (json_file_path ): with open (json_file_path, 'r' , encoding='utf-8' ) as file: data = json.load(file) questions = [entry["question" ] for entry in data] return questionsdef save_to_excel (questions ): df = pd.DataFrame(questions, columns=["Question" ]) df.to_excel("Excel文件名" , index=False , engine='openpyxl' ) questions = extract_questions_from_json("F://" ) save_to_excel(questions)print ("已保存为questions.xlsx" )
** 本项目基于开源,用于讨论和技术探讨,如果使用者用其做任何违法或者不正当行为,均尤其使用者自己承担。**