ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I know you are new to scripting but you really need to do some trialling of your own.
What I mean is, try running the following:
Code:
cat alertpause | wc -l | echo alertlog
At the command prompt and see what actually happens??
The way scripting works is we are trying to implement a solution that would be run by hand and take a long time to do manually.
So essentially anything you can do on the command line is then used in your script as an entry.
Hence your question:
Quote:
#how to run python program in here ? calling python maybe ?
My answer would be, how do you run it on the command line?
I know you are new to scripting but you really need to do some trialling of your own.
What I mean is, try running the following:
Code:
cat alertpause | wc -l | echo alertlog
At the command prompt and see what actually happens??
The way scripting works is we are trying to implement a solution that would be run by hand and take a long time to do manually.
So essentially anything you can do on the command line is then used in your script as an entry.
Hence your question:
cat alertpause | wc -l will print 'how many lines in alertpause log files' then in my case it would be printed 4, I still didn't get it in echo alertlog, cause when I ran 'cat alertpause | wc -l | echo alertlog' it will just print alertlog, without showing how many lines in alertpause.
Yeah, I'm currently new in bash scripting
now, I tried using tail but the printed log was didn't like what I expected.
Quote:
Originally Posted by grail
My answer would be, how do you run it on the command line?
just type python smsgateway.py "cell phone number" "message"
here python "message" parameter should read from alertpause then sent the last information about attack log files.
I believe that /var/log/snort always logging a new alert if there is an intrusion or an attack, I wonder how to make the earlier bash script to running in daemon mode, it will logging every new file in /var/log/snort then printed out in new file called alertpause. This is the real goal of my idea.
Now I'm using swatch to tail every new file in /var/log/snort/alert, and it works great, but the log file is too much complicated and I need a new file a little bit easier to read so I used the the previous bash script, and it works great again..thanx...but now I'm going deeper and can't sleep to think about my curiosity. Here, I got a new idea to start tailing alertpause with swatch but it nothing happens, cause I should running bash parsetext.sh every time to make itu logged on alertpause..
I wonder how to make it keep always read /var/log/snort/alert automatically which the last line of the alert will be printed out in alertpause, so the alertpause will be kept on updating the log, each time snort got an attack/intrusion ?
here's parameter what I want;
[kind of attack][the priority][time][source ip][destination ip]
It would be easier if you run Snort with "-A fast" as this creates single line alerts. As an exercise it's definitely nice to code a alerting app but why try to reinvent the wheel when there's apps around? Or don't Snort.org, Freshmeat or Sourceforge list one that seems usable to you?
It would be easier if you run Snort with "-A fast" as this creates single line alerts. As an exercise it's definitely nice to code a alerting app but why try to reinvent the wheel when there's apps around? Or don't Snort.org, Freshmeat or Sourceforge list one that seems usable to you?
yes that's good idea, I'm sorry if my mind still growing like a young kid in here, but I tried to learn the basic idea to do more development on my network system. I have read a lot about snort conf @ snort.org, and I haven't opened yet the freshmeat..thx for the idea..
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.