I need upload project from the HMI Pro Face GP37W2, without original project. But the project blocked on password in India many years ago. The password can be only digital from 1 to 4 symbol. I wrote simply program, which click on 'upload' button and then types number into textfield. If password is incorrect, program decrements it and type again. But program checked all possible password from 0 to 9999 and the correct password was not found. Can anybody hellp me, please?
I used python, PyautoGui(simulate keyboard input) and PyWin32(detect which window is open now).
Screens
Show
Main Window - http://uploads.ru/BFM0O.jpg
Paswword input - http://uploads.ru/Ojt50.jpg
Incorrect password - http://uploads.ru/Sv5DP.jpg
Program output - http://uploads.ru/V8Xq1.jpg
Paswword input - http://uploads.ru/Ojt50.jpg
Incorrect password - http://uploads.ru/Sv5DP.jpg
Program output - http://uploads.ru/V8Xq1.jpg
Program code
Show
Code: Select all
import win32gui
import pyautogui
import time, os
RECEIVE_X = 965 #Coordinates X receive button
RECEIVE_Y = 60 #Coordinates Y receive button
def transfer():
password = 9999 #Start password number
w = win32gui
while password >= 0: #End password number
if w.GetWindowText(w.GetForegroundWindow()) == 'Save File': #Window 'Save File' showing if password is correct
break
elif w.GetWindowText(w.GetForegroundWindow()) == 'Transfer': #On Transfer Window click on 'Upload' button
pyautogui.click(RECEIVE_X, RECEIVE_Y)
time.sleep(8) # time to connect HMI
elif w.GetWindowText(w.GetForegroundWindow()) == 'Register Password': # In this window enter the current password
time.sleep(0.2)
print ('Try password %i' % password)
pyautogui.typewrite(str(password), 0.1)
pyautogui.press('enter')
if password % 20 == 0: # log in file
f = open(u'D:\Proface_Brutforce\log.txt', 'a')
f.write('Password = %i \n' % password)
f.close()
time.sleep(1.2)
elif w.GetWindowText(w.GetForegroundWindow()) == 'Invalid Password!': #if password incorrect
password -= 1
pyautogui.press('enter')
transfer()