Home » SAP » SAP Solution Manager Key Generator (linux version)

SAP Solution Manager Key Generator (linux version)

RSS Link

  • An error has occurred; the feed is probably down. Try again later.

Blog Stats

  • 699,696 hits


Categories


The following bash script should produce installation key for SAP Solution Manager (SOLMAN) basing on three input values: SID, SN and HOSTNAME.

The script is based on popular VB script available here: http://kohanov.com/tmp/sap_keys.vbs

Feel free to use/modify/redistribute the script for both private and commercial use.

#!/bin/bash
# SAP Solution Manager Installation Key Generator
# by: redloff (IRCnet: #+kwa)
# license: free for personal and commercial use
if [ $# -ne 3 ]; then
 echo "use: $0 "
 exit 1
fi
if [ ${#1} -ne 3 ]; then
 echo "SID has to consist of exactly 3 characters"
 exit 2
fi
if [ ${#2} -ne 2 ]; then
 echo "SN has to consist of exactly 2 characters"
 exit 2
fi
function ascii { echo -n $1 | od -d | sed -n "s/^.* //gp"; }
SIDSN=`echo $1$2 | tr [a-z] [A-Z]`
SERV=`echo $3 | tr [a-z] [A-Z]`
for i in `seq 0 $((${#SIDSN}-1))`; do
 SIDSNhex[$i]=`ascii ${SIDSN:${i}:1}`
done
##echo "SIDSNhex: ${SIDSNhex[*]}"
for i in `seq 0 $((${#SERV}-1))`; do
 SERVhex[$i]=`ascii ${SERV:${i}:1}`
done
for i in `seq ${#SERV} 14`; do
 SERVhex[$i]=0
done
##echo "SERVhex: ${SERVhex[*]}"
if [ ${#SERV} -gt 0 -a ${#SERV} -lt 5 ]; then
 for i in `seq ${#SERV} 4`; do
 SERVhex[$i]=32 #ascii space char
 done
##    echo "SERV between 0 a 5"
fi
if [ ${#SERV} -gt 5 -a ${#SERV} -lt 10 ]; then
 for i in `seq ${#SERV} 9`; do
 SERVhex[$i]=32 #ascii space char
 done
##    echo "SERV between 5 a 10"
fi
if [ ${#SERV} -gt 10 -a ${#SERV} -lt 15 ]; then
 for i in `seq ${#SERV} 14`; do
 SERVhex[$i]=32 #ascii space char
 done
##    echo "SERV between 10 a 15"
fi
##echo "SERVhex: ${SERVhex[*]}"
for i in `seq 0 4`; do
 reshex[$i]=`echo $(((((0^${SIDSNhex[$i]})^${SERVhex[$i]})^${SERVhex[$(($i+5))]})^${SERVhex[$(($i+10))]}))`
done
##echo "reshex: ${reshex[*]}"
reshex[0]=`echo $((${reshex[0]}^84^0))`
reshex[1]=`echo $((${reshex[1]}^131^11))`
reshex[2]=`echo $((${reshex[2]}^194^46))`
reshex[3]=`echo $((${reshex[3]}^52^105))`
reshex[4]=`echo $((${reshex[4]}^119^188))`
##echo "reshex: ${reshex[*]}"
hexstr=(0 1 2 3 4 5 6 7 8 9 A B C D E F)
for i in `seq 0 4`; do
 hihex=`echo $((${reshex[$i]}/16))`
 lohex=`echo $((${reshex[$i]}%16))`
 resstr=${resstr}${hexstr[$hihex]}${hexstr[$lohex]}
done
echo "Installation key: $resstr"

To use the code, just paste it into a file (ex: solmankg.sh)
Set execution rights (chmod 755 solmankg.sh)
Execute the script with three arguments: SID, SN, HOSTNAME (ex: ./solmankg.sh AA1 00 FLUFFY)


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

My twitter post @devratt

February 2020
M T W T F S S
 12
3456789
10111213141516
17181920212223
242526272829  

Popularity


PageRank

Bookmark and Share
%d bloggers like this: