Filtering Fake inputs


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Filtering Fake inputs
# 1  
Old 08-04-2009
Filtering Fake inputs

Hi
My script takes input for a hostname.

echo "enter hostname [abcd123.efgh.ijk.com]
read hostname


Now I would like to filter the fake inputs.My hostnames always follow same syntax ( abcd123.efgh.ijk.com).

Appreciate everyones suggestions on this..Thanks..
# 2  
Old 08-04-2009
You could either:

1. Try pinging the servername given and only proceed if it succeeds but then other machines on the network could be entered and accepted.

2. Have a text file listing the hosts, one per line, run a:
Code:
cat -n hostfilelist

To present the hosts names with a number in front of each, then ask the user to select a host by entering the number and then do something like:
Code:
read NUMBER
SELECTEDSERVER=`cat -n hostfilelist | grep "^${NUMBER} " | awk '{ print $NF }'`

# 3  
Old 08-04-2009
Mmmmmm...

we have a complex environment..servers come and go quite often..all i want to check is

For ex:
If the input is 23bck.demo.tes.com--it should be rejected
2s39.demo.test.com--it should be rejected..
and
If the input is abcd123.efgh.ijk.com--it should be accepted.

Just wanted to check the input is entered in proper format or not...Thanks Tony..

---------- Post updated at 05:08 PM ---------- Previous update was at 04:25 PM ----------

Bingo..It worked...I used "nslookup" instead of ping...Have to say thanks to Tony..for throwing some light on this one.. Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Cybersecurity

Fake MicroSoft calls

Dear colleagues, it's that time of the year again: in recent days and weeks I'm receiving annoying numbers of annoying "support" calls from dubious "MicroSoft Centers" telling me that my computer generates errors and / or downloads malicious SW. Although ignoring these pesterers on the phone,... (8 Replies)
Discussion started by: RudiC
8 Replies

2. UNIX for Dummies Questions & Answers

fake email sender

Hi, I am using the below command to send the email. mailx -s "test from `hostname`" email@gmail.com < attachment.txt id uid=870(wlsuser) gid=641(wlsgrp) I recieve the email as "From: wlsuser@hostname Can I somehow have any string instead of wlsuser, if that grows too complex to... (4 Replies)
Discussion started by: shifahim
4 Replies

3. IP Networking

What is a fake network device?

Thanks in advance! Ben (1 Reply)
Discussion started by: bigben1220
1 Replies

4. UNIX for Dummies Questions & Answers

fake network address....

Good morning! Why would having a fake network device be useful? Thanks in advance Bigben (0 Replies)
Discussion started by: bigben1220
0 Replies

5. UNIX for Advanced & Expert Users

port mapping with fake ip

Hi there, i have a question to all. The task is: Redirect port from local host to remote (datapipe etc.) with faking my ip. For example, nmap with -S option make fake ip of host it being running. pic: -> 10.1.1.1:80 ... (1 Reply)
Discussion started by: lecter
1 Replies

6. Shell Programming and Scripting

Fake deletion of files

Hi, This is possibly an odd request to do with permissions as I seem to have tied myself up with these! I have the following directory (see below) that contains files that the 'usergrp' user needs to be able to 'delete' files from. drwxr-s--- 2 usergrp usergrp 512 16 Feb 14:37... (2 Replies)
Discussion started by: Peejay
2 Replies

7. Solaris

system Fake IPs

hi all ; I am using solaris 8 over SPARC . i was given the role to administer a webmail server running Iplanet 4.2 i was told also that this server is running a website . this server has 2 fake IPs . My question is how i can know these fake IPs and how they are mapped . cheers (2 Replies)
Discussion started by: ppass
2 Replies

8. Linux

Fake System32 Folder

I read somewhere that you can create a fake system32 folder in linux where you can store the most common windows runtime libraries, that way you can install windows programs (using wine) directly in linux, what I meen is that even the installer works. Does anyone know how I can do this, and where... (2 Replies)
Discussion started by: Kimm
2 Replies
Login or Register to Ask a Question