@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet
Page: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30



Comments:

<0> now, if you read about how regex works, you'll see how preg_replace() is capable of doing that you need.
<1> Woudln't trim with a suitable charlist be better?
<2> But wouldn't I have to specify every single character I want to replace?
<0> s/that/what/
<1> preg_replace
<0> Matthew^^: not if you learn how to use character cl***es, no.
<0> Jonnay: trim only removes from the beginning and end of a string. it's not suitable for what he wants.
<1> doh. right.
<2> ([-._0-9a-z]+) this?
<3> easiest way to remove trailing (,) and all (\n) ?
<1> ***uming , is always trailing,, substr, and str_replace.
<3> it is not always trailing.. i want to remove all newlines, and then any resulting trailing commas
<1> ugh. That "sentence" was a disaster. Sorry.
<3> What?
<2> so I could say replace everything except ([-._0-9a-z]+) with noting
<1> Matthew^^: Yup. in fact, [^\-._0-9a-z] is "everything except [-._0-9a-z]



<2> ok
<2> thanks
<1> (hmm, I don't know if the first dash needs to be escaped like that...
<1> but it can't hurt.
<2> so
<2> $text = preg_replace("[^\-._0-9a-z]", "", $text);
<1> no.
<4> when a cookie is already set, does changing the value of $_COOKIE['name'] change the value of the store cookie?
<4> stored*
<4> or does it require re-setting the cookie
<4> with setcookie(){
<1> shadowhand: Nope.. you need to re-set the cookie I believe.
<4> ?
<4> great >.<
<4> thanks
<2> Whats wrong with it Jonnay?
<1> Matthew: /[^\-._0-9a-z]+/
<2> Ah yeah
<2> Thanks
<2> That worked
<2> bye
<5> hello
<5> how can I run tcpdump from php ?
<6> exec()\
<5> Stormchaser: can I run root commands from php ?
<7> spuds: I would use proc_open then read the stdout in a loop
<8> spuds: uh... yeah, but i really really really wouldn't unless your doing some command line only stuff
<5> nathe: I just start tcpdump
<3> How do I remove any newlines from a string, and remove the last character if it is a comma
<8> spuds: look very carefully at how the command is p***ed then
<8> if there is any user input in it at all, make sure it is escaped thouroghly
<8> and try not to have any user input at all
<5> there is no userinput. I wouldn't even think about users running command line stuff
<5> :)
<8> heh
<8> just making sure :)
<5> but this script doesnt really do what it is supposed to do
<5> http://pastebin.com/554796
<5> can you maybe take a look
<8> you might consider sudo
<5> nathe, how do I tell php my sudo p***word ?
<3> spuds: wow.
<3> putting p***words in scripts = bad idea
<3> spuds: your entire script = bad idea
<5> myconid, why ?
<8> yeah, it does sound like a really bad idea
<3> spuds: basic security practices
<3> spuds: run tcpdump as root.. drop to a log file.. and open that log file with php if youy want
<8> because any time you give anything elevated privilages it becomes a target
<3> but for the love of god dont give a script root access
<5> guys. This server can only be accessed by one ip, which is mine. It is not a production server, it is pure development
<3> spuds: its BAD practice.
<5> myconid, WHY
<3> spuds: consiter the following, 'i only use my saftey on my gun when i am around others..'
<6> myconid: Indeed... Why is that a bad practice?
<3> as when i am home alone.. it doesnt matter..
<3> yo ucan still shoot yourself in the head
<8> because any vulnerablility anywhere along that chain, and you've got elevated privilages
<8> in this case... root
<3> Stormchaser: because there is ABSOLUTELY no excuse for doing that.
<6> That's a different matter...



<3> Stormchaser: if you worked for me and pulled something like that, I would fire you on the spot.
<6> I was interested in 'putting the p***words in your script' thing...
<5> okay. So there is no way I can run tcpdump without root, cannot I give tcpdump special privileges, like able to run without sudo
<8> and for now you can only access it from your ip, but there is always the possiblity of your ip being spoofed
<5> People, I was not going to put the p***word in the script
<3> spuds: Run tcpdump from cron or something.. and view the log file with php
<3> but dontrun tcpdump from php
<5> I was just wondering how I could use sudo in exec() because php has no way of knowing my root p***
<3> spuds: yes it is possible.
<6> spuds: You can allow apache to run tcpdump via sudo...
<5> myconid, how do I do that
<3> spuds: no im not telling you how.. because its stupid.
<5> Stormchaser, do you want to tell me ?
<3> you might as well make a script exec("rm $_GET['file']");
<6> spuds: It's simple... `sudo tcpdump
<6> `
<5> myconid, that is the most stupid id I have ever heard
<9> read the sudo manual, you can configure it to allow user X to run script Y as user Z
<3> spuds: its not far off from what you did.
<5> I run a program that tracks network protocols.
<3> im aware of what TCPDUMP does.
<5> myconid, it is way off.
<5> not even close of rm
<3> if yo uhve an exec() with root privs..
<5> myconid stop it.
<8> heh
<8> even better
<9> don't use sudo in exec. set up the thing you want to run in /etc/sudoers
<5> Okay another question. How can I track network traffic from php?
<3> its bad practice.
<3> spuds: run tcpdump from the command line into a log file, and open that file with php
<8> it's like exec("cat $_GET['file']");
<5> myconid, I cannot bash script.
<3> spuds: write a whatever script you want..
<5> I have truly no idea how I could do date('Ymd')_traffic.log
<8> heh
<8> you can script it in php
<8> look at the manual for command line stuff
<5> ... I cannot run tcpdump from there
<1> Learning is fun!
<3> what are you REALLY doing?
<5> Learning ****s! when it doesnt have priority at all.
<6> wha?
<5> myconid. I write a script that will be crontabbed.
<5> it logs network traffic and writes it to a file, for one hour.
<1> Make it a priority. Life gets easier that way.
<5> Jonnay: there are 100 of things I have to learn to make my life easier.
<5> bash scripting is just not top priority
<8> your not listening to me
<8> you can script from php
<5> I just wanted to use tcpdump to monitor my spiderbot and then remove/delete/unlink the tcpdump script and go live with the spider
<10> nathe: er.. yes.
<8> jsoft: i'm telling spud
<8> :P
<1> play around with echo, ` and date, and you are about 90% there...
<5> So if noone wants to help me run a innocent little program like tcpdump from php I go look for help somewhere else.
<1> tcpdump ... > `date (some arugments?)`_stufff
<5> If you want to protect me, better help me or I will fall in the hands of fearless hackers.
<3> it sounds like you really have no idea what your doing at all.
<5> why not?
<10> because its hard to interpret text commands using a web based html super.
<1> spuds: I just gave you about 80% of your bash script. If you can figure out what arguments to feed date, then you are finished.
<3> spuds: fix your script you are 'monitoring;
<5> myconid, what do you mean ?
<3> what are you using tcpdump for ?
<3> what are you monitoring
<5> mycondid, I monitor the connections my spider makes. To avoid ddos-attack like connections when my script happens not to do what it is supposed.
<3> Then have your script drop log files and monitor those
<8> why are you spidering anyway :P
<5> myconid. I rather get into the very core of my network connection.
<3> again, 'you dont know what your doing' comes back into play.
<11> i'm trying to parse a *.csv file so that i can generate an ***ociative array based on a "table" in that file... i'm able to pull all the table headings into a single numeric array, but i'm having trouble building a "blank" array with the values of the numeric array as keys... any ideas?


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #php
or
Go to some related logs:

convert bin to deb
sfill ubuntu
#perl
apache2 suse-10 outside
#sql
perlexp rename
#debian
accidentally chowned files
#perl
xchat colors



Home  |  disclaimer  |  contact  |  submit quotes