Programming :: Make A Bash Script That Will Open Up Port 23 For A Netcat Connection?

Apr 14, 2009

I'm starting to like making bash scripts. It's kewl making creative ones. Right now I'm trying to make a bash script that will open up port 23 for a netcat connection. Once there's a connection, I'd like for the script to open up xmms and play a sound effect, as well as echo a txt file to the desktop saying that a connection was made at this specific time. When I execute the script, it stops exection at the first line. So far I have this:

sudo nc -lvnp 23
while [ 1 ]
do

[code]...

View 8 Replies


ADVERTISEMENT

Red Hat / Fedora :: Netcat / Port Redirection - When A Connection Is Received On A Port Say 123?

Apr 6, 2010

i am running ncat (netcat's new version from nmap) on centos . I am listening on different ports. My question is , is it possible that when a connection is received on a port say 123, i redirect this connection to a different port and use the 123 port again for listening connections. ncat has an option -k which u can add with -l , it will force fully listen on the port. It can accept multiple connections on a single port but i want that once a client connects on to 123 port, he is forwarded to some other port and no longer on 123.

View 4 Replies View Related

Ubuntu Servers :: Port 21 Reported Open By Nmap And Netcat, But Blocked By Iptables?

Oct 11, 2010

Strange issue here when trying to verify firewall on Server 8.04. No ftp service running at all on server, but both nmap and netcat report port 21 as being open, even though it isn't.I am 100% sure that port 21 is not actually accessible and iptables rules are fine. Trying to connect to the port fails, yet nmap and netcat seem to report a "false positive"?Have also checked on a number of other servers I'm running, and this "false positive" seems to apply to all of them.

View 1 Replies View Related

Programming :: Bash : How To Make Firefox Open But Minimize

May 3, 2011

I am relatively new to scripting, but I was wanting to open a firefox window from a bash script, but have it open, then minimize. In the script, I have a single instance of: firefox & but is there a way to minimize it, versus have it displayed on the screen? I was wanting the command terminal to remain visible and it can't since the firefox window is open in front of it. I looked all over the place, including the man pages, but to no avail. I can make the height and width changes, but no minimize. Either that, or to be able to bring the terminal window back to the front automatically.

View 5 Replies View Related

OpenSUSE Network :: Port Forwarding Not Working - Tests Using Netcat

May 17, 2011

I have two SUSE(2.6) virtual machines running in the same subnet with two network cards each as shown below.

VM1------------------------------------------------------------------------------
appstage1:~ # ifconfig
eth0 Link encap:Ethernet HWaddr 00:0C:29:22:5A:24
inet addr:192.168.128.12 Bcast:192.168.128.255 Mask:255.255.255.0
inet6 addr: fe80::20c:29ff:fe22:5a24/64 Scope:Link

[Code]....

Ultimately my DB will run in VM2 and any DB requests coming in at 2055 of VM1 should be forwarded to port 2055 of VM2. Since I do not yet have a DB running I am trying to test with netcat.

View 5 Replies View Related

Software :: Capturing Data From IP Port In Background Using Telnet Or Netcat (nc)?

Mar 4, 2010

I'm trying to capture incoming/outgoing phone call data. Both telnet and nc have allowed me to easily direct this data to a file for later processing, HOWEVER I can't seem to get either to work as a background process. I want to put the connection into a shell script and run from cron.

View 4 Replies View Related

Security :: Make Connection Track For Port 80?

Jan 24, 2010

i need to do a statefull firewall actually i try the ESTABLISHED state but as we know that some people can play with the TCP header so i want to do a "connection track" state, they told me in mangle but i didn't find can someone paste for me a link about "connection track" or write for me rule for ex: to make connection track for port 80!

View 4 Replies View Related

Ubuntu Servers :: Connection On Port 143 - Iptables Are Open?

Feb 2, 2010

I am configuring an internal only IMAP server for archival emails. I am absolutely baffled why my connection is being refused. UFW is disabled and IPTABLES has a rule to allow all connections on 143 and 993. When I telnet this response is given:

Code:
telnet localhost 143
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection refused
Even nmap shows the port closed. Here is my iptables rule:
HTML Code:
-A ufw-user-input -p udp -m udp --dport 143 -j ACCEPT

View 3 Replies View Related

Networking :: Using Netcat To Make A Simple Proxy?

Nov 21, 2010

I made a simple proxy using netcat and it works great, the idea is to make the server and client communicate through two named pipes, file1, file2.

$ mknod file1 p
$ mknod file2 p
$ nc -l -p 12345 0<file1 1>file2 &
$ nc 192.168.2.118 80 1>file1 0<file2 &

The problem Im facing is that I cant seem to intercept the data going between the client and the server. I want to be able to have the data coming to the server in a variable, manipulate it and send it to the client, and the other way, have the data coming to the client in a variable, manipulate it and send it to the server.

Im running on an embedded device where tee, awk and many other commands are absent. how can I redirect the data to a variable, manipulate it and pass it to the other side, that is the question.

View 6 Replies View Related

General :: Lpq Printer 'sdst@other.domain' - Cannot Open Connection - Connection Timed Out Make Sure LPD Server Is Running On The Server

Mar 23, 2011

Linux printing appeared to be working fine up until yesterday. Today typing lpq gives the following: lpq Printer 'sdst@other.domain' - cannot open connection - Connection timed out Make sure LPD server is running on the server

The /etc/cups/printers.conf file is properly set, the printers appear in localhost:631 and they are printing test pages. However, all command line print commands seem to be trying to print to sdst@other.domain I don't know why printers.conf is being ignored and why and how sdst@other.domain was added. Seems like it might have been auto-discovered?

# dit: sdst@other.domain was mentioned in /usr/local/etc/lpd.conf I'm not sure why lpd.conf is being used instead of /etc/cups/printers.conf

View 1 Replies View Related

Programming :: C - Serial Port Won't Open?

Sep 1, 2010

I'm using C serial in a program to open and use a serial port but the port won't open for one reason or another. The program successfully runs on a different computer and when using RealTerm: Serial Capture Program, I can connect through the serial port with the same settings as I'm attempting through my c code. Anyone have any idea why it might be failing? I know this is still pretty vague, so let me know if there's other things I can tell you that might help to finding a solution

View 3 Replies View Related

Networking :: How To Open A Port - Failed To Open The TCP Port Number In The License

Jun 20, 2009

I am running lmgrd on CentOS5, but it returns Failed to open the TCP port number in the license. The port is 27000, how can I open that port?

View 5 Replies View Related

Programming :: Use Bash To Open A File?

Dec 12, 2010

How do I use bash to open a file, (file name as first parameter) cut n char from begin of each line, and write shortened lines to new file (outputfile name as the second parameter, n as the third parameter)

View 3 Replies View Related

Ubuntu Networking :: Cannot Activate Open Wifi Connection / Make That Possible?

Nov 11, 2010

I have a problem with my wifi adhoc network which I previously had under Windows. I go to network connections, edit connection ,wireless,add then change to adhoc then I cannot press the add button as it is not highlighted, I don't want any security so have not enterd any WEP or WPA information, also How do I do a scan for wireless networks/devices in my area?
I have a number of devices plus the chap next door who connects to my wired internet connection using my wifi adhoc network that are unable to do so at present.

View 2 Replies View Related

Programming :: Make Bash Replace The Value Of A Variable?

Apr 18, 2009

I have a program I am writing where I have a for loop and I want to make it substitute the variable twice like:

for ((i=0;i<5;i++)) do
echo $"$i"
done

[code]...

View 3 Replies View Related

Programming :: C Program - To Make Scripts That Can Talk To Server's Parallel Port

Jun 27, 2010

I need to make some C program under linux to make some scripts that can talk to my Server's Parallel port by sending some quare signal as high or low, so what i can do ?

View 4 Replies View Related

General :: Make Ncftp Hold The Connection Open Longer Than The Default ?

Jan 18, 2011

Is there a way to make ncftp hold the connection open longer than the default? a ping every 10 sec or something? I feel like after I push a change up to the server before I can verify everything is working as expected and get back into ncftp the connection is closed by the remote host.

View 1 Replies View Related

Programming :: Make A Automated Build-script With Bash?

Apr 14, 2010

I'm trying to make a automated build-script with bash but i keep getting different errors that I can't seem to figure out. Could anyone please tell me what's wrong with this package of build-scripts? I'm posting the main build-script and attaching the rest of the scripts in a compressed form. The errors mainly comes from the scripts in "/first_installation/usr/share/siem-live/init"

[Code]...

View 2 Replies View Related

Programming :: Bash Script - Make Sure All Files Have Certain Permissions

Jan 14, 2011

How can I iterate over all the files in the current directory to check for certain permissions? This is what I have:

Code: #!/bin/bash
for file in *.tar.gz
do if [ -r "$file" ]
then echo "$file is readable"
else echo "$file is NOT readable"
fi done

But this only checks that the current user has read permissions for each file. I want to check that the group "others" has read permissions for each file. How can I do this? Is there a built in function to check if a file has read permissions for the "others" group? Otherwise, I thought I might be able to use this:
Code: $ stat --format=%a file
744 And parse the output "744" and make sure the 3rd number is between 4 and 7 (since the octals 4-7 have read permissions for others).

View 2 Replies View Related

Programming :: Make An Automated Build-script With Bash

Apr 14, 2010

I'm trying to make a automated build-script with bash but I keep getting different errors that I cant't seem to solve for various reasons. what's wrong with this build-script? I'm posing the main build-script and attaching the rest of the scripts in a compressed form. Buld-script link: [URL]

[Code]....

View 3 Replies View Related

Programming :: Make 2 Separate Arguments In 1 Bash Script?

Aug 31, 2010

This is what I have:

Code:
#!/bin/bash
#ascript.sh

[code]...

View 8 Replies View Related

Programming :: Make A Flawless Bash Alarm Script

Jan 12, 2011

I am not positive that this is the right subforum for this post. It is technically a programming question but I am not sure if this is the best place for bash scripting questions. Anyhow, I have been having trouble getting up in the morning. I am a pretty good morning person and once I am up, I am good to go. The problem is getting out of bed. Traditional alarms have just not cut it in the past; there is always an easy way to shut them off and go back to sleep.

Recentliesh, I decided to try to make an alarm script in bash that would be more successful in getting my lazy behind out of bed. I am a newbie bash scripter at best so my attempts have been very simple but have not cut it so far. Here are some examples:

[Code]....

The above script was the version of my bash alarm. It will not stop ringing until I input that ridiculous phrase. The big issue with this script was that I would input the phrase quickly and go back to sleep. It was however, much more successful than traditional alarm clocks. Another obvious pitfall was that even though control-c'ing the process would not work, the terminal could be closed and that would be the end of it. I'll get back to that issue. Here is my second attempt:

[Code]....

View 7 Replies View Related

Programming :: Dynamically Supply Input To Netcat In A Script?

Mar 5, 2010

I am trying to write an irc bot to run interactive fiction games in a channel. I am connecting to the channel using nc. I'm having a hell of a time trying to supply input stdin for nc after the connection is established. Here's what's going on. I've got lines of plain text in a file with the irc commands required to identify the bot's ID and join the channel. I can connect easily using any of the following commands

cat inputfile | nc irc.servername.org 6667 -i 1
nc irc.servername.org 6667 -i 1 < inputfile
Named_Pipe | nc irc.servername.org 6667 -i 1
cat inputfile > Named_Pipe

With the first two commands nc connects, reads the file with some time between each line allowing the irc server to respond, bringing me into the channel. It then begins to receive stdin from the command line allowing me to do things like "privmsg #channelname :Hello World!!!" sending messages to the room. This is not the desired behavior. I require nc to take additional stdin from the inputfile if I cat additional text to the end of it.

The last set of commands using the named pipe seem like it does the same, but it doesn't actually send anything to the room, which indicates to me that perhaps nc is continuing to take stdin from the named pipe (this is the desired behavior) rather than dropping to the console for stdin. If I try to cat more plain text data to the end of the named pipe, however, either with something like "echo 'privmsg #channelname :Hello World!!!' > Named_Pipe" (or >> instead of >) or with a filename in place of the "echo" command the whole command simply seems to hang until I press ctrl-C.

I don't understand what I'm doing wrong. With anonymous and named pipes, and with redirection, the problem seems to be the same. nc seems to take it's stdin from the file until it hits the end of file, at which point I can no longer introduce new lines of plain text as stdin for the running nc process.

View 4 Replies View Related

Programming :: Write A Bash Script That Will Make Some Web Stats Reports

Jun 23, 2010

I'm planing to write a bash script that will make some web stats reports and I'm stuck on beginning because I don't know how can I read a directory content, put everything in a variable, compare the variable value with current date and go further.More specific ...

I have /var/apache/log/. Here I have access logs on date ( like access.log.24.06.2010.gz and so on ).

How can I do to automatically zgrep (in a bash script) last day .gz ??

View 3 Replies View Related

Programming :: Bash Script To Test For Open FTP Sessions From Specific Clients?

Apr 8, 2009

I look after a server which accepts automatic overnight PASV FTP uploads from remote clients. When the uploads are complete, my Bash script copies the files to another location. The problem is, my script needs to be a bit smarter when it comes to detecting active FTP sessions.

I was using:

Code:

netstat -n | grep ":21 " | grep ESTABLISHED

to test if there were active sessions, but came unstuck when a local user left an unrelated FTP session active. The result - my script hung around all night thinking there was an active upload from a remote client. My server is behind a firewall, so remote clients all show an internal (NAT) address,so I can't differentiate by source IP address.I can't install LSOF or FUSER for security reasons. Is there a way I can test for active FTP sessions from specific users? I am running Red Hat Enterprise Linux Server release 5.2 (Tikanga).

View 7 Replies View Related

Programming :: Bash - Ps - Psgrep And Read /proc/$pid Make Script Exit

Mar 22, 2011

I have not been able to write bash to use a PID file to ensure no other instance of the same script is running! All three methods I can think of to see if the PID in the PID file is another instance of the script make the script exit with a return code of 1 but the same commands run at the command prompt work as expected.

The first attempt was:

Code:

The first attempted workaround was:

Code:

The second attempted workaround (with debug to make the following command prompt copy and paste meaningful) was:

Code:

Here's the command prompt session, testing with a stale PID file and then manually running the problem command and it behaving as expected:

Code:

This on Slackware64 13.1 which has bash 4.1.7.

In desperation I tried rebooting but the behaviour was the same.

View 2 Replies View Related

Programming :: Make A Bash Script Start Automaticly When System Restart?

Apr 4, 2009

ia have this script
#!/bin/bash
if [ -e /tmp/mysql.pipe ]; then

[code]...

View 3 Replies View Related

Programming :: Write A Bash Script To Time Some Downloads From A Server Using Ftp Connection?

Jun 8, 2010

I write a bash script to time some downloads from a server using ftp connection. ( something like: "time ftp 'options' ) I need to count the time for a list of files in a loop and output the result in a file.

View 1 Replies View Related

Programming :: Bash: Rename Files In Alphabetical Order And Make Extensions Uppercase?

Oct 21, 2010

I am trying to write a bash script that will extract a .cbr (.rar) file, traverse the extracted files in alphabetical order and rename them 001.JPG, 002.JPG, 003.JPG, etc.So far I only have this much to extract it:

Code:
#!/bin/bash
#

[code]....

View 8 Replies View Related

Programming :: C / C++ Scripts For Make Hunting Call In Open IMS

Nov 15, 2010

I am a newbie in linux n programming, I need to use ubuntu for my research at school about building an IMS server use openims.

The problem is I need an additional script in C/C++ for my openims server to make an extension call. I hope one number can represent 3 client as receiver/operator. So, when I call the number, the server can forward the call to those three receiver by hunt.
1st call will be forward to the 1st receiver.
2nd call will be forward to the 2nd receiver.
3rd call will be forward to the 3rd receiver.
then, 4th call will be forward back to the 1st receiver, etc.

View 7 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved