<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0); background-color: rgb(255, 255, 255);">
<pre style="list-style: outside none none; margin: 0px; padding: 5px 0px 5px 5px; line-height: 1.4; overflow-wrap: break-word; font-size: 14px; color: rgb(51, 51, 51); background-color: rgb(255, 255, 255);"><span style="margin: 0px; color: rgb(0, 0, 0);" class="elementToProof">netifaces?</span></pre>
<pre style="list-style: outside none none; margin: 0px; padding: 5px 0px 5px 5px; line-height: 1.4; overflow-wrap: break-word; font-size: 14px; color: rgb(51, 51, 51); background-color: rgb(255, 255, 255);" class="elementToProof"><span style="margin: 0px; color: rgb(0, 0, 0);" class="elementToProof ContentPasted0"><a href="https://pypi.org/project/netifaces/" id="LPlnkOWALinkPreview">https://pypi.org/project/netifaces/</a><br></span></pre>
<div class="_Entity _EType_OWALinkPreview _EId_OWALinkPreview _EReadonly_1">
<div id="LPBorder_GTaHR0cHM6Ly9weXBpLm9yZy9wcm9qZWN0L25ldGlmYWNlcy8." class="LPBorder327155" style="width: 100%; margin-top: 16px; margin-bottom: 16px; position: relative; max-width: 800px; min-width: 424px;">
<table id="LPContainer327155" role="presentation" style="padding: 12px 36px 12px 12px; width: 100%; border-width: 1px; border-style: solid; border-color: rgb(200, 200, 200); border-radius: 2px;">
<tbody>
<tr valign="top" style="border-spacing: 0px;">
<td>
<div id="LPImageContainer327155" style="position: relative; margin-right: 12px; height: 160px; overflow: hidden;">
<a target="_blank" id="LPImageAnchor327155" href="https://pypi.org/project/netifaces/"><img id="LPThumbnailImageId327155" alt="" height="160" style="display: block;" width="160" src="https://pypi.org/static/images/twitter.6fecba6f.jpg"></a></div>
</td>
<td style="width: 100%;">
<div id="LPTitle327155" style="font-size: 21px; font-weight: 300; margin-right: 8px; font-family: wf_segoe-ui_light, "Segoe UI Light", "Segoe WP Light", "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; margin-bottom: 12px;">
<a target="_blank" id="LPUrlAnchor327155" href="https://pypi.org/project/netifaces/" style="text-decoration: none; color: var(--themePrimary);">netifaces ˇ PyPI</a></div>
<div id="LPDescription327155" style="font-size: 14px; max-height: 100px; color: rgb(102, 102, 102); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif; margin-bottom: 12px; margin-right: 8px; overflow: hidden;">
Hashes for netifaces-0.11.0-cp39-cp39-manylinux_2_5_x86_64.manylinux1_x86_64.whl; Algorithm Hash digest; SHA256 ...</div>
<div id="LPMetadata327155" style="font-size: 14px; font-weight: 400; color: rgb(166, 166, 166); font-family: wf_segoe-ui_normal, "Segoe UI", "Segoe WP", Tahoma, Arial, sans-serif;">
pypi.org</div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
<br>
</div>
<div id="appendonsend"></div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>Feladó:</b> Techinfo <techinfo-bounces@lista.edu.hu>, meghatalmazó: Zsolt Nagy <nagyzsolt80@gmail.com><br>
<b>Elküldve:</b> 2022. október 18., kedd 19:04<br>
<b>Címzett:</b> Techinfo <techinfo@lista.edu.hu><br>
<b>Tárgy:</b> [Techinfo] Python + hálózati kártya lekérdezések, beállítások</font>
<div> </div>
</div>
<div>
<div dir="ltr">Tisztelt Listatagok!
<div><br>
</div>
<div>Kérnék szépen segítséget, hogy Python nyelvben a számítógépem:</div>
<div>Host nevét, IP címét, MAC címét, alhálózati maszkját, alapértelmezett átjáróját, elsődleges DNS-ét, másodlagos DNS-ét</div>
<div>egy-egy változóba tudjam menteni.<br>
</div>
<div><br>
</div>
<div>az első 3 még ment is :)<br>
</div>
<div><br>
</div>
<div>----------------------------------------------------------------------------------</div>
<div>import socket<br>
import uuid<br>
<br>
hostname = socket.gethostname()<br>
ip_address = socket.gethostbyname(hostname)<br>
<br>
</div>
<div>print(hostname)<br>
print(ip_address)<br>
print (hex(uuid.getnode()))<br>
<br>
print ("A MAC cím formázott módon:", end="")<br>
print (':'.join(['{:02x}'.format((uuid.getnode() >> ele) & 0xff)<br>
for ele in range(0,8*6,8)][::-1]))<br>
----------------------------------------------------------------------------------<br>
<br>
</div>
<div>Viszont a többi rész már megakasztott:</div>
<div><br>
</div>
<div>első ötletem a <b>netsh</b> parancs</div>
<div><br>
</div>
<div>import os<br>
mine = os.popen('<span style="background-color:rgb(227,230,232); color:rgb(35,38,41); font-family:ui-monospace,"Cascadia Mono","Segoe UI Mono","Liberation Mono",Menlo,Monaco,Consolas,monospace; font-size:13px; white-space:pre-wrap">netsh interface ip show address
| findstr "IP Address</span>')</div>
<div>myip = mine.read()<br>
print (myip)<br>
</div>
<div><br>
</div>
<div>Ennél egyszerűbb meglolásst tudna-e valaki ajánlani?<br>
</div>
<div><br>
</div>
<div>Előre is köszönömm az ötleteket.</div>
<div><br>
</div>
<div><br>
</div>
<div>Üdvözlettel:</div>
<div>Zsolt</div>
</div>
</div>
</body>
</html>