Sign in to follow this  
Followers 0
clariceo0

Free library for resetting windows password?

6 posts in this topic

Recently, I am interested to build a windows app to reset Windows login password as a side off project. I am still a newbie in programming so i am not able to build the app from scratch. Is there any open source  project i could learn from on this?

Share this post


Link to post
Share on other sites



Hi, @clariceo0, welcome to the forum. A couple of questions to help us help you:

  • Are you looking to change the password from within the machine itself or remotely?
  • Are you doing this on domain computers, or just local users on local PCs?
  • Are you wanting to allow users to do this themselves (something sitting on the desktop they can click on), and if so do they have administrative rights to do so?

The more info you can provide us with, the better we can assist you, so we're not throwing out suggestions that may not work for your situation.


√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites
12 hours ago, JLogan3o13 said:

Hi, @clariceo0, welcome to the forum. A couple of questions to help us help you:

  • Are you looking to change the password from within the machine itself or remotely?
  • Are you doing this on domain computers, or just local users on local PCs?
  • Are you wanting to allow users to do this themselves (something sitting on the desktop they can click on), and if so do they have administrative rights to do so?

The more info you can provide us with, the better we can assist you, so we're not throwing out suggestions that may not work for your situation.

 thanks for the great suggestion. I just want to change or reset the password of local account. I will write a GUI client for this to help normal users without much technical knowledge.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

@clariceo0 Usually we follow more of a "teach a man to fish" motto rather than just handing folks scripts, but I had this one lying about. It should give you an idea how to proceed anyway; you will probably need to modify to your needs. Also you'll want to test heavily; it is an older script which I have not tested on Windows 10. Let me know if you have any questions:

#include <EditConstants.au3>
#include <GUIConstantsEx.au3>

Local $sUserName, $sPassword

$hGUI = GUICreate("Reset Local Password", 300, 300)
    GUISetState(@SW_SHOW)
    GUISetFont(11, 400, Default, "Arial")

    $lblUserName = GUICtrlCreateLabel("Username", 115, 10, 65, 30)
    $lblPassword = GUICtrlCreateLabel("Choose New Password", 75, 90, 150, 30)
    $lblVerify = GUICtrlCreateLabel("Verify New Password", 75, 170, 150, 30)

    $inpUserName = GUICtrlCreateInput(@UserName, 10, 40, 280, 30, $ES_CENTER)
    $inpPassword = GUICtrlCreateInput("", 10, 120, 280, 30, $ES_PASSWORD)
    $inpVerify = GUICtrlCreateInput("", 10, 200, 280, 30, $ES_PASSWORD)

    $btnGo = GUICtrlCreateButton("Change Password", 10, 250, 125, 35)
    $btnClose = GUICtrlCreateButton("Exit", 165, 250, 125, 35)

    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE, $btnClose
                ExitLoop
            Case $btnGo
                If GUICtrlRead($inpPassword) == GUICtrlRead($inpVerify) Then
                    $sUserName = GUICtrlRead($inpUserName)
                    $sPassword = GUICtrlRead($inpPassword)
                    _changePW($sUserName, $sPassword)
                Else
                    MsgBox(0, "Reset Local Password", "Passwords do not match!")
                EndIf
        EndSwitch
    WEnd

Func _changePW($UserName, $Password)
    $oUser = ObjGet("WinNT://" & @ComputerName & "/" & $UserName)
        If IsObj($oUser) Then
            $oUser.SetPassword($Password)
            $oUser.SetInfo
        EndIf
EndFunc

 

   Edit: Also, although you posted in a C++ forum you didn't specify that you need this done in C++/C. Are you just looking to get the job done, or do you have a language requirement that it needs to be coded in?

Edited by JLogan3o13
1 person likes this

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

@JLogan3o13 thanks for the help. I will figure out the code myself and port it into C++.  so i can build a GUI with QT.  I find a good example of the program called UUkeys. Here is the tutorial on how to reset windows password. that is exactly what i am looking for.

Edited by clariceo0

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

On ‎12‎/‎05‎/‎2016 at 7:40 AM, Aquarium said:
On ‎11‎/‎05‎/‎2016 at 3:29 AM, clariceo0 said:

Recently, I am interested to build a windows app to reset Windows login password as a side off project. I am still a newbie in programming so i am not able to build the app from scratch. Is there any open source  project i could learn from on this?

You can use the api fuction NetUserChangePassword.

#ifndef UNICODE
#define UNICODE
#endif
#pragma comment(lib, "netapi32.lib")

#include <stdio.h>
#include <windows.h> 
#include <lm.h>

int wmain(int argc, wchar_t *argv[])
{
   DWORD dwError = 0;
   NET_API_STATUS nStatus;
   //
   // All parameters are required.
   //
   if (argc != 5)
   {
      fwprintf(stderr, L"Usage: %s \\\\ServerName UserName OldPassword NewPassword\n", argv[0]);
      exit(1);
   }
   //
   // Call the NetUserChangePassword function.
   //
   nStatus = NetUserChangePassword(argv[1], argv[2], argv[3], argv[4]);
   //
   // If the call succeeds, inform the user.
   //
   if (nStatus == NERR_Success)
      fwprintf(stderr, L"User password has been changed successfully\n");
   //
   // Otherwise, print the system error.
   //
   else
      fprintf(stderr, "A system error has occurred: %d\n", nStatus);

   return 0;
}

 

 

Edited by Melba23
Removed ad link in quote

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0

  • Similar Content

    • colombeen
      By colombeen
      Hi guys,
      I have a pretty advanced question...
       
      This is the issue i'm facing :
      On a regular basis we need to install pfx certificates (with password protection) on devices from external companies.
      To install the certificate we always have to contact the user, setup a really dull and long process to get an RDP session to that device, install the certificate.
       
      I'm looking for :
      a way to generate exe files on the fly, that will include the pfx file and password, and automatically install them without any interaction from the user, and the user not being able to retrieve the password to install the certificate.
       
      Question :
      Is this possible with AutoIT? And if so, does anyone have a working example for the certificate installation part or the auto generate with file include?
       
      Thx in advance
      colombeen
    • likehu
      By likehu
      Hello,
      I have compiled a reference DLL in VS 2015 Community and this  DLL works fine with project for which it is used. There is an interface from which u can access functions in DLL.
      Developers stated that this DLL is almost universal and can be used with any language with minor changes.
      I am trying to access its function from Autoit script and got an error 3, after calling DLLCall - "function" not found in the DLL file.
      Please have a quick look, I feel I miss something in C++ library with exporting functions and I do not know what to add as I am new to C++.
      Thank you.
      Source files and script also attached.
       
      Here is my script.
      Local $dll = DllOpen("C:\Users\Home\Desktop\dll\user.dll") ConsoleWrite("$dll handle = " & $dll & @CRLF) ;$dll handle = 1 Local $result = DllCall($dll, "double:cdecl", "ProcessQuery", "str", "dll$mynumber") If @error > 0 Then ConsoleWrite("Error: " & @error & @CRLF) ;Error = 3 If IsArray($result) Then ConsoleWrite("Array returned!" & @CRLF & "dll$mynumber: " & result[1]) Else ConsoleWrite("$result is not array. : " & $result & @CRLF) ;$result = 0 EndIf DllClose($dll) And here is dll source. As I understand, function "ProcessQuery" exported with help of DLL_IMPLEMENTS
      user.h
      //****************************************************************************** // // This file is part of the OpenHoldem project // Download page: http://code.google.com/p/openholdembot/ // Forums: http://www.maxinmontreal.com/forums/index.php // Licensed under GPL v3: http://www.gnu.org/licenses/gpl.html // //****************************************************************************** // // Purpose: Very simple user-DLL as a starting-point // // DO NOT CHANGE ANYTHING IN THIS FILE! // // This Header defines an interface // Functions and data-types must exactly match. // //****************************************************************************** #ifndef _INC_USER_H #define _INC_USER_H // Import and export directives // for use by this DLL and by OpenHoldem #ifdef USER_DLL #define DLL_IMPLEMENTS extern "C" __declspec(dllexport) #define EXE_IMPLEMENTS extern "C" __declspec(dllimport) #else #define DLL_IMPLEMENTS extern "C" __declspec(dllimport) #define EXE_IMPLEMENTS extern "C" __declspec(dllexport) #endif // Number of saved table-states // This number must not be changed, as we do a "& 0xFF" // at various places to normalize the index. const int kNumberOfHoldemStatesForDLL = 256; // SHoldemePlayer // used for sequence of 256 consequive table-states // !!!! Needs 2 more cards for Omaha, if not entirely removed struct holdem_player { char m_name[16] ; //player name if known double m_balance ; //player balance double m_currentbet ; //player current bet unsigned char m_cards[2] ; //player cards unsigned char m_name_known : 1 ; //0=no 1=yes unsigned char m_balance_known : 1 ; //0=no 1=yes unsigned char m_fillerbits : 6 ; //filler bits unsigned char m_fillerbyte ; //filler bytes }; struct holdem_state { char m_title[64] ; //table title double m_pot[10] ; //total in each pot unsigned char m_cards[5] ; //common cards unsigned char m_is_playing : 1 ; //0=sitting-out, 1=sitting-in unsigned char m_is_posting : 1 ; //0=autopost-off, 1=autopost-on unsigned char m_fillerbits : 6 ; //filler bits unsigned char m_fillerbyte ; //filler byte unsigned char m_dealer_chair ; //0-9 holdem_player m_player[10] ; //player records }; // Functions implemented and exported by the DLL, // imported by OpenHoldem DLL_IMPLEMENTS double __stdcall ProcessQuery(const char* pquery); DLL_IMPLEMENTS void __stdcall DLLOnLoad(); DLL_IMPLEMENTS void __stdcall DLLOnUnLoad(); // Functions implemented and exported by OpenHoldem, // imported by the DLL EXE_IMPLEMENTS double __stdcall GetSymbol(const char* name_of_single_symbol__not_expression); EXE_IMPLEMENTS void* __stdcall GetPrw1326(); EXE_IMPLEMENTS char* __stdcall GetHandnumber(); EXE_IMPLEMENTS void __stdcall ParseHandList(const char* name_of_list, const char* list_body); EXE_IMPLEMENTS char* __stdcall ScrapeTableMapRegion(char* p_region, int& p_returned_lengh); EXE_IMPLEMENTS void __stdcall SendChatMessage(const char *message); EXE_IMPLEMENTS void __stdcall WriteLog(char* format, ...); // Variables exported by OpenHoldem // avoiding the message-mess of WinHoldem, // no longer sending any state-messages // http://www.maxinmontreal.com/forums/viewtopic.php?f=174&t=18642 EXE_IMPLEMENTS extern holdem_state state[kNumberOfHoldemStatesForDLL]; EXE_IMPLEMENTS extern int state_index; #endif // _INC_USER_H  
      user.cpp    Here is dll$mynumber parameter.
      //****************************************************************************** // // This file is part of the OpenHoldem project // Download page: http://code.google.com/p/openholdembot/ // Forums: http://www.maxinmontreal.com/forums/index.php // Licensed under GPL v3: http://www.gnu.org/licenses/gpl.html // //****************************************************************************** // // Purpose: Very simple user-DLL as a starting-point // // Required OpenHoldem version: 7.7.6 // //****************************************************************************** // Needs to be defined here, before #include "user.h" // to generate proper export- and inport-definitions #define USER_DLL // #define OPT_DEMO_OUTPUT if you are a beginner // who wants to see some message-boxes with output of game-states, etc. // It is disabled upon request, // * as it is not really needed // * as some DLL-users don't have MFC (atlstr.h) installed // http://www.maxinmontreal.com/forums/viewtopic.php?f=156&t=16232 #undef OPT_DEMO_OUTPUT #include "user.h" #include <conio.h> #include <windows.h> #ifdef OPT_DEMO_OUTPUT #include <atlstr.h> #endif OPT_DEMO_OUTPUT // Supporting macros #define HIGH_NIBBLE(c) (((c)>>4)&0x0F) #define LOW_NIBBLE(c) ((c)&0x0F) // Card macro #define RANK(c) ( ISKNOWN(c) ? HIGH_NIBBLE(c) : 0 ) #define SUIT(c) ( ISKNOWN(c) ? LOW_NIBBLE(c) : 0 ) #define ISCARDBACK(c) ((c) == CARD_BACK) #define ISUNKNOWN(c) ((c) == CARD_UNDEFINED) #define ISNOCARD(c) ((c) == CARD_NOCARD) #define ISKNOWN(c) (!ISCARDBACK(c) && !ISUNKNOWN(c) && !ISNOCARD(c)) // ProcessQuery() // Handling the lookup of dll$symbols DLL_IMPLEMENTS double __stdcall ProcessQuery(const char* pquery) { if (pquery==NULL) return 0; if (strncmp(pquery,"dll$mynumber",13)==0) { return 12345.67; } return 0; } // OnLoad and OnUnload() // called once and at the beginning of a session // when the DLL gets loaded / unloaded // Do initilization / finalization here. DLL_IMPLEMENTS void __stdcall DLLOnLoad() { #ifdef OPT_DEMO_OUTPUT MessageBox(NULL, "event-load", "MESSAGE", MB_OK); #endif OPT_DEMO_OUTPUT } DLL_IMPLEMENTS void __stdcall DLLOnUnLoad() { #ifdef OPT_DEMO_OUTPUT MessageBox(NULL, "event-unload", "MESSAGE", MB_OK); #endif OPT_DEMO_OUTPUT } // DLL entry point // Technically required, but don't do anything here. // Initializations belong into the OnLoad() function, // where they get executed at run-time. // Doing things here at load-time is a bad idea, // as some functionalitz might not be properly initialized // (including error/handling). BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: #ifdef OPT_DEMO_OUTPUT AllocConsole(); #endif OPT_DEMO_OUTPUT break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; case DLL_PROCESS_DETACH: #ifdef OPT_DEMO_OUTPUT FreeConsole(); #endif OPT_DEMO_OUTPUT break; } return TRUE; }  
      Source.zip
      DllAccess.au3
    • ur
      By ur
      With _WinWaitActivate we can wait for a window to process it.
      But is there any logic so that we can wait for this window title and based on the window text (like 2 or more patterns will be there) we can click yes or no on the window.
       
      Func _WinWaitActivate($title,$text,$timeout=0)
       WinWait($title,$text,$timeout)
       If Not WinActive($title,$text) Then WinActivate($title,$text)
       WinWaitActive($title,$text,$timeout)
      EndFunc
    • 31290
      By 31290
      Hi Guys, 
      Hope you're fine today!
      I'd like to create a small GUI that, when clicking a button, the password set in the GUICtrlCreateInput is revealed and when the click is released, the password is hidden again. W8/10 style in fact...
      Here's what I have so far:
      #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) f_RemedyUpdate() While 1 Sleep(10) Wend Func f_RemedyUpdate() $gMailCreds = GUICreate("SEE CHECKLISTS", 300, 140) GUISetBkColor($Color_White) GUISetFont(8.5, 700, 0) GUICtrlCreateLabel("Password required for your account" , 5, 10) GUICtrlCreateLabel("Your Password:", 10, 70, 100, 30) $g_PassInput = GUICtrlCreateInput("", 110, 66, 150, 20, $ES_PASSWORD) GUICtrlSetColor(-1, 0x800080) $g_ShowPassButton = GuiCtrlCreateButton ("", 270, 67, 16, 16, $BS_ICON) GUICtrlSetImage(-1, "C:\eye.ico") GuiCtrlSetOnEvent ($g_ShowPassButton, "f_ShowPassword") $g_SubmitBtn = GUICtrlCreateButton ("Submit", 120, 100, -1, -1, $BS_DEFPUSHBUTTON) GUICtrlSetOnEvent(-1, "f_SendMail") GUISetOnEvent($GUI_EVENT_CLOSE, "_exit") GUISetState(@SW_SHOW) EndFunc Func f_ShowPassword() $s_PWD = GuiCtrlRead ($g_PassInput) If $s_PWD = "" Then Msgbox (64, "Your password", "You did not type any password") Else Msgbox (64, "Your Password", "You typed --> " & $s_PWD & " <-- as password.") EndIf EndFunc I've enclosed the small ico file I'm using 
      Thanks in advance for any help provided
      -31290
       
      eye.ico
    • wtarkan
      By wtarkan
      If I create a service to run a program , Application window cannot Appear - How can I make the App window visible