Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

I cannot read information from Windows Registry using python on windows 8.1

Posted on 2016-08-26
2
Medium Priority
?
130 Views
Last Modified: 2016-08-27
This script returns the MAC addresses and network names of all the WiFi networks you have joined. But when I run on my pychram python 2.7.12 it gives me the following out put:

C:\Python27\python.exe C:/Users/Bdd/PycharmProjects/untitled6/pp.py
Process finished with exit code 0

from _winreg import *

def val2addr(val):

    addr = ''

    for ch in val:

        addr += '%02x '% ord(ch)

    addr = addr.strip(' ').replace(' ', ':')[0:17]

    return addr

def printNets():

    print '[+] '

    net = "SOFTWARE\Microsoft\Windows NT\CurrentVersion"+\
          "\NetworkList\Signatures\Unmanaged"
    key = OpenKey(HKEY_LOCAL_MACHINE, net)

    print '\n[*] Networks You have Joined.'

    for i in range(100):
        try:
            guid = EnumKey(key, i)

            netKey = OpenKey(key, str(guid))

            (n, addr, t) = EnumValue(netKey, 5)

            (n, name, t) = EnumValue(netKey, 4)


            macAddr = val2addr(addr)

            netName = str(name)

            print '[+] ' + netName + ' ' + macAddr

            CloseKey(netKey)
        except:

            break

def main():

    printNets()

if __name__ == "__main__":

    main()

Open in new window

0
Comment
Question by:zrdad mont
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 83

Accepted Solution

by:
David Johnson, CD, MVP earned 2000 total points
ID: 41772925
32 bit python on x64 system you need to specify you want x64 version of registry and not syswow64 section

key = OpenKey(HKEY_LOCAL_MACHINE, net, 0, KEY_READ | KEY_WOW64_64KEY)

Open in new window


You may need administrative permissions (run as administrator) test via command prompt
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList

Open in new window

0
 

Author Closing Comment

by:zrdad mont
ID: 41773029
Thanks, solution worked perfectly fine
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Security measures require Windows be logged in using Standard User login (not Administrator).  Yet, sometimes an application has to be run “As Administrator” from a Standard User login.  This paper describes how to create a shortcut icon to launch a…
OfficeMate Freezes on login or does not load after login credentials are input.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question