Что нового

[Элементы GUI] Генерация Email адресов

arabnesso

Новичок
Сообщения
17
Репутация
0
Добрый день, прошу помощи, нужно сделать, чтобы генерировались email, в зависимости от выбора "Mail.ru" или "gmail", нужно добавить вторую строку и чтобы как я и сказал выше, генерировались рандомный email в первую строку и рандомный пароль во вторую строку.

Код:
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Array.au3>


Global $pInputSerial
Global $sWinTitle = "Generator email"
Global $iPars[3] = [Random(111, 999, 1), Random(111, 999, 1), Random(111, 999, 1)], $iFSNA[4]
Global $sComboKeys[2] = ["Mail", "Gmail"]
Global $sComboFuns[2] = ["_GenerateFSNFromHDD", "_GenerateFSNFromRandomNumber"]
Global $sTemp = ""
Global $iCurPars[4] = ["", $iPars[0], $iPars[1], $iPars[2]]



$hWindow = GUICreate($sWinTitle, 322, 170)
GUISetIcon("shell32.dll", -45)
$pInputSerial = GUICtrlCreateInput("", 8, 104, 305, 21)
$pButtonGenerate = GUICtrlCreateButton("Generate", 8, 128, 153, 33, 0)
$pLabelSeeder = GUICtrlCreateLabel("Seeder: " & $iPars[0] & " - " & $iPars[1] & " - " & $iPars[2], 8, 8, 200, 17)
$pCombo = GUICtrlCreateCombo("", 8, 80, 305, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
For $i = 0 To UBound($sComboKeys) - 1
$sTemp &= $sComboKeys[$i] & "|"
Next
GUICtrlSetData(-1, $sTemp)
Global $pCheckboxSeeder = GUICtrlCreateCheckbox("Seeder constant", 8, 32, 105, 17)
$pInputSerialNum = GUICtrlCreateInput("10", 75, 55, 73, 21)
$pCheckboxMSN = GUICtrlCreateCheckbox("Create", 8, 56, 65, 17)

$pButtonInfo = GUICtrlCreateButton("Info", 240, 6, 73, 25)
GUISetState(@SW_SHOW)



While 1
If GUICtrlRead($pCheckboxMSN) = 1 Then
GUICtrlSetState($pCheckboxSeeder, $GUI_CHECKED)
EndIf
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit
Case $pButtonGenerate
$sT = GUICtrlRead($pCombo)
$iFunNum = _ArraySearch($sComboKeys, $sT)
If $iFunNum <> -1 Then
Call($sComboFuns[$iFunNum])
Else
MsgBox(16, "Info - Error", "Please select a Seedersource!")
EndIf
Case $pButtonInfo
MsgBox(1, "Info", "Generate email " & @CRLF & @CRLF & "Generate.")
EndSwitch
WEnd



Func _GenerateSerial($iSeed = 0, $iFiveDataSeed = 0, $iSevenDataSeed = 0, $iNineDataSeed = 0)
Local $bDone, $iDataF, $iDataN, $iDataS



If $iFiveDataSeed <= 2 Or $iSevenDataSeed <= 2 Or $iNineDataSeed <= 2 Then
GUICtrlSetData($pInputSerial, "0000-0000-0000")
MsgBox(16, "Info - Error", "Invalid Seeder Values!")
Else
$bDone = False
$iDataF = ($iSeed * Random(2, 20, 1)) + 5
Sleep(100)
$iDataS = ($iSeed * Random(2, 20, 1)) + 7
Sleep(100)
$iDataN = ($iSeed * Random(2, 20, 1)) + 9



While Not $bDone
$bDone = True
If Mod($iDataF, $iFiveDataSeed) <> 0 Then
$iDataF = $iDataF - 1
$bDone = False
EndIf
If Mod($iDataS, $iSevenDataSeed) <> 0 Then
$iDataS = $iDataS - 1
$bDone = False
EndIf
If Mod($iDataN, $iNineDataSeed) <> 0 Then
$iDataN = $iDataN - 1
$bDone = False
EndIf
WEnd
$sSerial = $iDataF & "-" & $iDataS & "-" & $iDataN
GUICtrlSetData($pInputSerial, $sSerial)
Return $sSerial
EndIf
EndFunc ;==>_GenerateSerial



Func _GenerateFSNFromRandomNumber()
$sSeederCatch = "Random Number"



$iStateSeeder = GUICtrlRead($pCheckboxSeeder)
$iStateMSN = GUICtrlRead($pCheckboxMSN)



If $iStateMSN = 1 Then
$iSerialsNum = GUICtrlRead($pInputSerialNum)
If Int($iSerialsNum) <= 0 Then
MsgBox(16, "Info - Error", "Not a valid entry!")
Else
$sPath = FileSaveDialog("Save Serials ...", @DesktopDir, "Text (*.license)")
If Not @error Then
$sPath &= ".license"
For $i = 1 To 3
$iFSNA[$i] = Random(111, 999, 1)
$iCurPars[$i] = $iFSNA[$i]
Next
GUICtrlSetData($pLabelSeeder, "Seeder: " & $iFSNA[1] & " - " & $iFSNA[2] & " - " & $iFSNA[3])
EndIf
FileWriteLine($sPath, "Serials Created With " & $sWinTitle)
FileWriteLine($sPath, "-------------")
FileWriteLine($sPath, "Catched By: " & $sSeederCatch)
FileWriteLine($sPath, "Seeder: " & $iCurPars[1] & " - " & $iCurPars[2] & " - " & $iCurPars[3])
FileWriteLine($sPath, "-------------")
FileWriteLine($sPath, "")
ProgressOn("Generating " & $iSerialsNum & " Serials", "Serial 1 from 100", "0 %")
$iTimer = TimerInit()
For $i = 1 To $iSerialsNum
$sTempSerial = _GenerateSerial(Random(999, 99999, 1), $iCurPars[1], $iCurPars[2], $iCurPars[3])
ProgressSet(($i / $iSerialsNum) * 100, Round(($i / $iSerialsNum) * 100, 2) & " % - " & $i & "/" & $iSerialsNum, "Serial: " & $sTempSerial)
FileWriteLine($sPath, $sTempSerial)
Next
ProgressOff()
$iTimerDiff = TimerDiff($iTimer)
FileWriteLine($sPath, "")
FileWriteLine($sPath, "Created in: " & Round($iTimerDiff / 1000, 2) & " Seconds")
MsgBox(64, "Info", "Serials generated successfully!")
Run('explorer "' & $sPath & '"')
EndIf
Else
If $iStateSeeder = 4 Then
For $i = 1 To 3
$iFSNA[$i] = Random(111, 999, 1)
$iCurPars[$i] = $iFSNA[$i]
Next
GUICtrlSetData($pLabelSeeder, "Seeder: " & $iFSNA[1] & " - " & $iFSNA[2] & " - " & $iFSNA[3])
_GenerateSerial(Random(999, 99999, 1), $iCurPars[1], $iCurPars[2], $iCurPars[3])
Else
_GenerateSerial(Random(999, 99999, 1), $iCurPars[1], $iCurPars[2], $iCurPars[3])
EndIf
EndIf



EndFunc ;==>_GenerateFSNFromRandomNumber



Func _GenerateFSNFromHDD()
Global $iHDD[1000], $z = 0, $iRandom, $sSeederCatch = "HDD"



$iStateSeeder = GUICtrlRead($pCheckboxSeeder)
$iStateMSN = GUICtrlRead($pCheckboxMSN)



If $iStateMSN = 1 Then
$iSerialsNum = GUICtrlRead($pInputSerialNum)
If Int($iSerialsNum) <= 0 Then
MsgBox(16, "Info - Error", "Not a valid entry!")
Else
$sPath = FileSaveDialog("Save Serials ...", @DesktopDir, "Text (*.license)")
If Not @error Then
$sPath &= ".license"
$sHDDn = DriveGetDrive("all")
If Not @error Then
If $sHDDn[0] < 3 Then
MsgBox(16, "Info - Error", "There must be at least 3 harddrives exist!")
Else
ReDim $iHDD[$sHDDn[0] + 1]
For $i = 1 To $sHDDn[0]
$iTemp = DriveGetSerial($sHDDn[$i])
If $iTemp <> "" Then
$iHDD[$i - $z] = $iTemp
Else
$z = $z + 1
ReDim $iHDD[$sHDDn[0] + 1 - $z]
EndIf
Next
EndIf
For $i = 1 To 3
$iFSNA[$i] = StringLeft($iHDD[Random(1, UBound($iHDD) - 1, 1)], 3)
$iCurPars[$i] = $iFSNA[$i]
Next
GUICtrlSetData($pLabelSeeder, "Seeder: " & $iFSNA[1] & " @ " & $iFSNA[2] & " @ " & $iFSNA[3])
EndIf
FileWriteLine($sPath, "Serials Created With " & $sWinTitle)
FileWriteLine($sPath, "-------------")
FileWriteLine($sPath, "Catched By: " & $sSeederCatch)
FileWriteLine($sPath, "Seeder: " & $iCurPars[1] & " @ " & $iCurPars[2] & " @ " & $iCurPars[3])
FileWriteLine($sPath, "-------------")
FileWriteLine($sPath, "")
ProgressOn("Generating " & $iSerialsNum & " Serials", "", "0 %")
$iTimer = TimerInit()
For $i = 1 To $iSerialsNum
$sTempSerial = _GenerateSerial(Random(999, 99999, 1), $iCurPars[1], $iCurPars[2], $iCurPars[3])
ProgressSet(($i / $iSerialsNum) * 100, Round(($i / $iSerialsNum) * 100, 2) & " % @ " & $i & "/" & $iSerialsNum, "Serial: " & $sTempSerial)
FileWriteLine($sPath, $sTempSerial)
Next
ProgressOff()
$iTimerDiff = TimerDiff($iTimer)
FileWriteLine($sPath, "")
FileWriteLine($sPath, "Created in: " & Round($iTimerDiff / 1000, 2) & " Seconds")
MsgBox(64, "Info", "Serials generated successfully!")
Run('explorer "' & $sPath & '"')
EndIf
EndIf
Else
If $iStateSeeder = 4 Then
$sHDDn = DriveGetDrive("all")
If Not @error Then
If $sHDDn[0] < 3 Then
MsgBox(16, "Info - Error", "There must be at least 3 harddrives exist!")
Else
ReDim $iHDD[$sHDDn[0] + 1]
For $i = 1 To $sHDDn[0]
$iTemp = DriveGetSerial($sHDDn[$i])
If $iTemp <> "" Then
$iHDD[$i - $z] = $iTemp
Else
$z = $z + 1
ReDim $iHDD[$sHDDn[0] + 1 - $z]
EndIf
Next
EndIf
For $i = 1 To 3
$iFSNA[$i] = StringLeft($iHDD[Random(1, UBound($iHDD) - 1, 1)], 3)
$iCurPars[$i] = $iFSNA[$i]
Next
GUICtrlSetData($pLabelSeeder, "Seeder: " & $iFSNA[1] & " @ " & $iFSNA[2] & " @ " & $iFSNA[3])
_GenerateSerial(Random(999, 99999, 1), $iCurPars[1], $iCurPars[2], $iCurPars[3])
EndIf
Else
_GenerateSerial(Random(999, 99999, 1), $iCurPars[1], $iCurPars[2], $iCurPars[3])
EndIf
EndIf
EndFunc ;==>_GenerateFSNFromHDD

[/autoit]
 
Автор
A

arabnesso

Новичок
Сообщения
17
Репутация
0
Или хотя бы можно другой пример с двумя строками, главное что бы каждая строка рандомила email и пароль к нему, перед этим конечно вначале выбирается нужный почтовый ящик из выпадающего списка.
 
A

Alofa

Гость
arabnesso сказал(а):
Или хотя бы можно другой пример...
Код:
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>

Global $iMinNum = 6, $asComboKeys[2] = ['Mail', 'Gmail']

$hWindow = GUICreate('Generator email', 322, 210)
GUISetIcon('shell32.dll', -45)
GUICtrlCreateLabel('Количество знаков E-mail:', 8, 20)
GUICtrlCreateLabel('Количество знаков пароля:', 8, 45)

$iNumCharEmail = GUICtrlCreateInput($iMinNum, 155, 15, 50)
GUICtrlCreateUpdown(-1)
GUICtrlSetLimit(-1, 30, $iMinNum)

$iNumCharKey = GUICtrlCreateInput($iMinNum, 155, 40, 50)
GUICtrlCreateUpdown(-1)
GUICtrlSetLimit(-1, 50, $iMinNum)

$iCombo = GUICtrlCreateCombo('', 8, 80, 305, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
For $i = 0 To UBound($asComboKeys) - 1
	GUICtrlSetData(-1, $asComboKeys[$i] & '|')
Next

$iInputEmail = GUICtrlCreateInput('', 8, 110, 305, 21)
$iInputKey = GUICtrlCreateInput('', 8, 140, 305, 21)
$iButtonGenerate = GUICtrlCreateButton('Generate', 8, 170, 153, 33, 0)
GUISetState(@SW_SHOW)

While 1
	Switch GUIGetMsg()
		Case $GUI_EVENT_CLOSE
			Exit
		Case $iButtonGenerate
			If GUICtrlSendMsg($iCombo, $CB_GETCURSEL, 0, 0) = -1 Then
				MsgBox(16, 'Info - Error', 'Please select a Seedersource!')
			Else
				$sComboText = GUICtrlRead($iCombo)
				GUICtrlSetData($iInputEmail, _Generate(GUICtrlRead($iNumCharEmail), $sComboText))
				GUICtrlSetData($iInputKey, _Generate(GUICtrlRead($iNumCharKey)))
			EndIf
	EndSwitch
WEnd


Func _Generate($iNum, $sStr = '')
	Local $i, $iRand, $sString
	If $sStr Then
		Do
			$iRand = Random(46, 122, 1)
			Switch $iRand
				; Какие символы включать в набор, а какие нет - Смотри описание: http://autoit-script.ru/autoit3_docs/functions/Chr.htm
				Case 46, 48 To 57, 97 To 122, 65 To 90 ; Фильтр. К примеру 65-90 - Диапазон заглавных латинских букв
					$sString &= Chr($iRand)
					$i += 1
				Case Else
					ContinueLoop
			EndSwitch
		Until $i >= $iNum
		$sString &= '@' & $sStr
	Else
		For $i = 1 To $iNum
			$sString &= Chr(Random(33, 126, 1))
		Next
	EndIf
	Return $sString
EndFunc   ;==>_Generate
 
Автор
A

arabnesso

Новичок
Сообщения
17
Репутация
0
Alofa сказал(а):
arabnesso сказал(а):
Или хотя бы можно другой пример...
Код:
#include <ComboConstants.au3>
#include <GUIConstantsEx.au3>

Global $iMinNum = 6, $asComboKeys[2] = ['Mail', 'Gmail']

$hWindow = GUICreate('Generator email', 322, 210)
GUISetIcon('shell32.dll', -45)
GUICtrlCreateLabel('Количество знаков E-mail:', 8, 20)
GUICtrlCreateLabel('Количество знаков пароля:', 8, 45)

$iNumCharEmail = GUICtrlCreateInput($iMinNum, 155, 15, 50)
GUICtrlCreateUpdown(-1)
GUICtrlSetLimit(-1, 30, $iMinNum)

$iNumCharKey = GUICtrlCreateInput($iMinNum, 155, 40, 50)
GUICtrlCreateUpdown(-1)
GUICtrlSetLimit(-1, 50, $iMinNum)

$iCombo = GUICtrlCreateCombo('', 8, 80, 305, 25, BitOR($CBS_DROPDOWNLIST, $CBS_AUTOHSCROLL))
For $i = 0 To UBound($asComboKeys) - 1
	GUICtrlSetData(-1, $asComboKeys[$i] & '|')
Next

$iInputEmail = GUICtrlCreateInput('', 8, 110, 305, 21)
$iInputKey = GUICtrlCreateInput('', 8, 140, 305, 21)
$iButtonGenerate = GUICtrlCreateButton('Generate', 8, 170, 153, 33, 0)
GUISetState(@SW_SHOW)

While 1
	Switch GUIGetMsg()
		Case $GUI_EVENT_CLOSE
			Exit
		Case $iButtonGenerate
			If GUICtrlSendMsg($iCombo, $CB_GETCURSEL, 0, 0) = -1 Then
				MsgBox(16, 'Info - Error', 'Please select a Seedersource!')
			Else
				$sComboText = GUICtrlRead($iCombo)
				GUICtrlSetData($iInputEmail, _Generate(GUICtrlRead($iNumCharEmail), $sComboText))
				GUICtrlSetData($iInputKey, _Generate(GUICtrlRead($iNumCharKey)))
			EndIf
	EndSwitch
WEnd


Func _Generate($iNum, $sStr = '')
	Local $i, $iRand, $sString
	If $sStr Then
		Do
			$iRand = Random(46, 122, 1)
			Switch $iRand
				; Какие символы включать в набор, а какие нет - Смотри описание: http://autoit-script.ru/autoit3_docs/functions/Chr.htm
				Case 46, 48 To 57, 97 To 122, 65 To 90 ; Фильтр. К примеру 65-90 - Диапазон заглавных латинских букв
					$sString &= Chr($iRand)
					$i += 1
				Case Else
					ContinueLoop
			EndSwitch
		Until $i >= $iNum
		$sString &= '@' & $sStr
	Else
		For $i = 1 To $iNum
			$sString &= Chr(Random(33, 126, 1))
		Next
	EndIf
	Return $sString
EndFunc   ;==>_Generate
Спасибо, все как нужно, как мне и нужно было)
 
Верх