Hard code the input of a script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Hard code the input of a script
# 1  
Old 12-13-2011
Hard code the input of a script

Hi All,

I have a script Abc . This is has only the privilege of execution. I cannot see the code. When I run the script "Abc" , It display set of name in an random order with a number 1.e
1 James
2 john
3 jack
4 neil
5 bob

If my name is neil , I am expected to type 4 and press enter
Now it displays months in random order. I am expected to enter the month in which I was born.

i.e
1 March
2 Jan
3 Feb
4 August
5 sep
.
.
.
....


Now let say I enter 4
My verification will be complete.


Is there a way were I can write an script to call abc and give the input as neil and august so that I don have to go through this manual process.



Ps: The example I have given above is just an paradigm to the problem I have for easy understanding. The real problem is similar.
# 2  
Old 12-13-2011
Code:
./script <<EOF
4
4
EOF

This User Gave Thanks to Corona688 For This Post:
# 3  
Old 12-13-2011
@Corona688 ur answer is applicable when I know that it is 4 , 4. But thats not the case. They change the order everyday. Name will remain same , Month will remain same but not the order . i.e. Neil can appear in 4th position today so i enter 4. Tomorrow it might be at position 6 in which case i have to enter 6

---------- Post updated at 08:06 AM ---------- Previous update was at 02:13 AM ----------

Any input from user who have experience or explored a similar type of issue.?
# 4  
Old 12-13-2011
If the input is variable then it's not hard-coded.

You'll need to read the output from the script to determine the correct input.
# 5  
Old 12-13-2011
For a start, its not a script but quite surely a binary... type
Code:
 file abc

If it is done in such a way, I suppose it is for security purpose for we (you also..) don't know what else it is doing ( and you haven't said anything about it either...)...
The way you wrote your question and with the information you gave, the immediate answer that comes to mind is : Simple! Don't call it...
If we knew a bit more perhaps the answer would be different, but then, we are not a hacking forum and don't like messing up what others put in place for security unless there is a very good reason.
# 6  
Old 12-13-2011
Something that changes isn't hardcoded...

You could try the expect language. It's built for dealing with program interfaces.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to use SQL Hard Code Conditions in UNIX Shell Script?

Hi All, I am trying to place one SQL query in Shell Script with Where Condition as Status='1' But after running the the script it is returning error as SQL0206N "1" is not valid in the context where it is used. SQLSTATE=42703 The query is working fine in Data Base. Please suggest... (1 Reply)
Discussion started by: sumanmca2006
1 Replies

2. UNIX and Linux Applications

[solved]Moving server...need to find all hard code IP references

I'm moving my web server to a different datacenter. OS is CentOS 5.8 Apache 2.2.3 qmail NcFTPd Its been 12 years since I relocated a server. Lots of brain cells lost since then...:-) I need to identify all the config files that contain the server's IP addresses. Memory has provided... (0 Replies)
Discussion started by: scasey
0 Replies

3. Shell Programming and Scripting

Script to delete files with an input for directories and an input for path/file

Hello, I'm trying to figure out how best to approach this script, and I have very little experience, so I could use all the help I can get. :wall: I regularly need to delete files from many directories. A file with the same name may exist any number of times in different subdirectories.... (3 Replies)
Discussion started by: *ShadowCat*
3 Replies

4. Linux

C++ Code to Access Linux Hard Disk Sectors (with a LoopBack Virtual Hard Disk)

Hi all, I'm kind of new to programming in Linux & c/c++. I'm currently writing a FileManager using Ubuntu Linux(10.10) for Learning Purposes. I've got started on this project by creating a loopback device to be used as my virtual hard disk. After creating the loop back hard disk and mounting it... (23 Replies)
Discussion started by: shen747
23 Replies

5. Shell Programming and Scripting

I have a bash script and tried very hard but i couldn't solve it please help

please can you help me with this script ( very very important ) what I'm trying is to write program that accepts list of user as its argument 1- If a user or more are given as arguments, the script should reset files permissions as follows: a. Directory ~/share to 750 (if it exists). b. All... (10 Replies)
Discussion started by: testman84
10 Replies

6. Shell Programming and Scripting

Need script to take input from file, match on it in file 2 and input data

All, I am trying to figure out a script to run in windows that will allow me to match on First column in file1 to 8th Column in File2 then Insert file1 column2 to file2 column4 then create a new file. File1: 12345 Sam 12346 Bob 12347 Bill File2:... (1 Reply)
Discussion started by: darkoth
1 Replies

7. Shell Programming and Scripting

Simple Script looking for Hard Coded Variables

Hi Guys Looking for a little help with a script to grep all files looking for hard coded variables - ie its IP address... so we know which files to look at before an IP change... This is what I have - but it seems to loop and never end... Any better suggestions? #!/usr/bin/ksh #simple... (2 Replies)
Discussion started by: serm
2 Replies

8. Solaris

I want to hard code username and password for an FTP connection

Hi all i want to do FTP via running a shell script and i want to hard code username and password for that particular server.. by writing it in a file can u help me in this regard.. Thank u Naree (2 Replies)
Discussion started by: naree
2 Replies

9. Filesystems, Disks and Memory

The best partitioning schem for a 250GB Sata hard drive & a 75GB SCSI hard drive

Hi I have 2 75GB SCSI hard drives and 2 250GB SATA hard drives which are using RAID Level 1 respectively. I wana have both FTP and Apache installed on them as services. I'm wondering what's the best partitioning schem? I wana use FC3 as my OS, so, I thought I can use the 75GB hard drive as the /... (0 Replies)
Discussion started by: sirbijan
0 Replies
Login or Register to Ask a Question