Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Shell 

Generating specific string

I need some tips on how to generate random strings with that contain only ^[A-Z1-9] (Yes, 1-9, without 0)

I can do this in the online generators, but I need to have this format A1B2C3.... etc letter,number,letter,number

Is there a fast way to do this with Fedora terminal? Should I install something?
(Dec 26, 2020 03:35 PM)absojedi Wrote:  I need some tips on how to generate random strings with that contain only ^[A-Z1-9] (Yes, 1-9, without 0)

I can do this in the online generators, but I need to have this format A1B2C3.... etc letter,number,letter,number

Is there a fast way to do this with Fedora terminal? Should I install something?

Perhpas a solution in vbscript that i have in my mind but still no tested yet ?
So you want to generate and validate someting like this combination of strings :
B5A3Z4R8H2...
And How long must be this output string ?
You can generate a random password with this batch script.


Code
@echo off & cls

setlocal enabledelayedexpansion

:Start
Cls
Echo.
Echo.


Set /p len="Password Length: "

Cls

set "alp=a A b B c C d D E e f F g G h H I I j J k K l L m M n N p P q Q r R s S t T u U v V w W x X y Y z Z 0 1 2 3 4 5 6 7 8 9"
set "cnt=0"
for %%a in (%alp%) do (
    set "rn.!cnt!=%%a"
    set /a "cnt+=1"
)
for /l %%i in (1,1,1) do (
set "pssw="
for /l %%a in (1,1,%len%) do (
    set /a "rand=!random! %% cnt"
    for %%b in (!rand!) do set "pssw=!pssw!!rn.%%b!"
)
Echo.
Echo Your random password is:  !pssw!
)

Echo.
Pause
Goto :Start
(Dec 27, 2020 10:45 AM)Hackoo Wrote:  Perhpas a solution in vbscript that i have in my mind but still no tested yet ?
So you want to generate and validate someting like this combination of strings :
B5A3Z4R8H2...
And How long must be this output string ?

It should be 10 chars long, but I already got it. I found this bash script
Code
#!/bin/bash
function generate { local length=$1; local letters=ABCDEFGHIJKLMNOPQRSTUVWXYZ; local numbers=123456789; for i in $(seq 1 "$length") ; do if (( i % 2 != 0)); then echo -n "${letters:RANDOM%${#letters}:1}"; else echo -n "${numbers:RANDOM%${#numbers}:1}"; fi; done; echo; }


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Java] by .eXeSep 16, 2020 03:39 AM 3 224 Sep 16, 2020 03:39 AM
Last Post: InterestingUser1111
[C#] by PawnhubNov 16, 2019 05:19 PM 20 908 Nov 16, 2019 05:19 PM
Last Post: SIM-4440595
[C] by MordiciaNov 15, 2019 07:21 PM 3 211 Nov 15, 2019 07:21 PM
Last Post: Mordicia