Jump to content

Converting a bash script to a windows bat?


Guest Frankish

Recommended Posts

Guest Frankish

This bit of code is by Paul and makes apk signature checking and sorting really simple. I used to use it on Ubuntu but don't have Ubuntu set up at the moment. Is anyone capable of converting it to a windows .bat for me? Thanks in advance!

#!/bin/bash


cd $1


for filename in *.apk

do

                unzip -d $filename.extract $filename META-INF/CERT.RSA

                if [ -f $filename.extract/META-INF/CERT.RSA ]

                then

                                mkdir `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`

                                mv $filename `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`/$filename

                                mv `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`/`echo $filename | sed 's/\(.*\.\)apk/\1odex/'`

                                rm -rf $filename.extract

                else

                                mkdir none

                                mv $filename none

                                mv `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` none

                                rm -rf $filename.extract

                fi

done;


mkdir other

mv * other

mv other/b399 platform

mv other/f2a7 shared

mv other/f2b9 media

mv other/936e test

Edited by Frankish
Link to comment
Share on other sites

The part of converting bash to windows bat is not the big problem you have in hands.

The big problem is the utils that normally you don't have in windows and that you have almost by default in a linux.

I'm naming just a few:

- cut

- sed

- grep

...

and so on...

you should download a live cd of linux, and use a pen drive to insert the data you want to sign and use the live linux distro to sign. It's much less work....

This bit of code is by Paul and makes apk signature checking and sorting really simple. I used to use it on Ubuntu but don't have Ubuntu set up at the moment. Is anyone capable of converting it to a windows .bat for me? Thanks in advance!

#!/bin/bash


cd $1


for filename in *.apk

do

                unzip -d $filename.extract $filename META-INF/CERT.RSA

                if [ -f $filename.extract/META-INF/CERT.RSA ]

                then

                                mkdir `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`

                                mv $filename `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`/$filename

                                mv `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` `keytool -printcert -v -file $filename.extract/META-INF/CERT.RSA|grep SerialNumber| cut -c 19-23`/`echo $filename | sed 's/\(.*\.\)apk/\1odex/'`

                                rm -rf $filename.extract

                else

                                mkdir none

                                mv $filename none

                                mv `echo $filename | sed 's/\(.*\.\)apk/\1odex/'` none

                                rm -rf $filename.extract

                fi

done;


mkdir other

mv * other

mv other/b399 platform

mv other/f2a7 shared

mv other/f2b9 media

mv other/936e test

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.