Finding all e-mail addresses in files on server.
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix administration > Finding all e-mail addresses in files on server.




Pages (2): [1] 2 »   Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Finding all e-mail addresses in files on server.  
ifoutch@gmail.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-04-05 01:49 AM

Looking for advice and/or examples on how to audit a server to find all
possible e-mail addresses listed in files. Need to verify and possibly
consolidate addresses for server monitoring and administration. What I
have been doing is greping  thru the filesystem and checking for
matches to entries in /etc/mail/aliases, /etc/password and any lines
containing "mail" (case insensitive) or "@" in crontabs, and scripts.

What I would like to do is create an exclude list of certain
directories. Then go through the remaining dirs. and extract mail
addresses and print them to a file with the filename. This would be run
on a production systems during off hours but still needs to be "nice"
to system resources. I want to automate this as much as possible. So
that we can periodically do an audit of all our systems.

Has anybody done anything like this previously? Any pointers or advice
greatly appreciated.






[ Post a follow-up to this message ]



    Re: Finding all e-mail addresses in files on server.  
Alan Connor


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-04-05 07:48 AM

On comp.unix.shell, in
<1112576768.533990.100930@z14g2000cwz.googlegroups.com>,
"ifoutch@gmail.com" wrote:


> Looking for advice and/or examples on how to audit a server
> to find all possible e-mail addresses listed in files. Need
> to verify and possibly consolidate addresses for server
> monitoring and administration. What I have been doing is
> greping thru the filesystem and checking for matches to entries
> in /etc/mail/aliases, /etc/password and any lines containing
> "mail" (case insensitive) or "@" in crontabs, and scripts.
>
> What I would like to do is create an exclude list of certain
> directories. Then go through the remaining dirs. and extract
> mail addresses and print them to a file with the filename. This
> would be run on a production systems during off hours but still
> needs to be "nice" to system resources. I want to automate this
> as much as possible. So that we can periodically do an audit of
> all our systems.
>
> Has anybody done anything like this previously? Any pointers or
> advice greatly appreciated.
>

I ran a search at http://groups.google.com/advanced_group_search

on ifoutch@gmail.com

This is the only post ever made on a Usenet textgroup under that
alias.

If you feel the need to hide, and want to extract email addresses
from a bunch of dirs, then you are probably a spammer. Or a
wannabee spammer.

Here's the script I wrote that does everything you want. All the
numbers and letters have been converted to Os with my handy
vi macro.

I learned some good things putting it together. Thanks.

And XXXX off.


(OOO OOO OOO OOOO)

#!/OOO/OOOO

OOO _OOOO OO $(OOOO / -OOOO "/OOO" -O -OOOO "/OOOO" -O \
-OOOO "/OOOO"\) -OOOOO -O -OOOO O -OOOOO)

do

OOO -O 'O/\(.*\)\([O-OO-OO-O_.+-]+@[O-OO-OO-O_.+-\
]+\.[O-OO-OO-O]+\)\(.*\)/\O/O' $_OOOO >> OOOOOOOOOO

OOOO

#OO OOOO OO OOO OOO OOOO OOOOO OOO OOO OOOO \
#(OOO,OOOO...) OO OOO OOOO OOOOOO.

OOOO O

AC







[ Post a follow-up to this message ]



    Re: Finding all e-mail addresses in files on server.  
ifoutch@gmail.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-04-05 07:48 AM

I have posted as ifoutch@yahoo.com and possibly even as
ifoutch@hotmail.com. I am a newbie SA trying to find my way in my new
job.

The reason for needing to extract mail addresses is that different
"admins" have created scripts that functioned as some sort of monitor
and notification system. The problem is that the notification may not
be going to an address that will be of any use anymore. So I am trying
to track these down and either retire the scripts or change the address
to something appropriate.

-- Ian Foutch
P.S. Nice manners you have when addressing someone you know nothing
about!






[ Post a follow-up to this message ]



    Re: Finding all e-mail addresses in files on server.  
Alan Connor


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-04-05 07:48 AM

On comp.unix.shell, in
<hC14e.2758$EE2.2426@newsread2.news.pas.earthlink.net>, "Alan
Connor" wrote:


> On comp.unix.shell, in
><1112576768.533990.100930@z14g2000cwz.googlegroups.com>,
>"ifoutch@gmail.com" wrote:
>
> 
>
>
> I ran a search at
> http://groups.google.com/advanced_group_search
>
> on ifoutch@gmail.com
>
> This is the only post ever made on a Usenet textgroup under
> that alias.
>
> If you feel the need to hide, and want to extract email
> addresses from a bunch of dirs, then you are probably a
> spammer. Or a wannabee spammer.
>
> Here's the script I wrote that does everything you want. All
> the numbers and letters have been converted to Os with my handy
> vi macro.
>
> I learned some good things putting it together. Thanks.
>
> And XXXX off.
>
>
> (OOO OOO OOO OOOO)
>
> #!/OOO/OOOO
>
> OOO _OOOO OO $(OOOO / -OOOO "/OOO" -O -OOOO "/OOOO" -O \
> -OOOO "/OOOO"\) -OOOOO -O -OOOO O -OOOOO)
>
> OO
>
> OOO -O 'O/\(.*\)\([O-OO-OO-O_.+-]+@[O-OO-OO-O_.+-\
> ]+\.[O-OO-OO-O]+\)\(.*\)/\O/O' $_OOOO >> OOOOOOOOOO
>
> OOOO
>
> #OO OOOO OO OOO OOO OOOO OOOOO OOO OOO OOOO \
> #(OOO,OOOO...) OO OOO OOOO OOOOOO.
>
> OOOO O
>
> AC
>
>

Oops! Made a booboo. Used eregexes where they won't work.

#!/OOO/OOOO

OOO _OOOO OO $(OOOO / -OOOO "/OOO" -O -OOOO "/OOOO" -O \
-OOOO "/OOOO"\) -OOOOO -O -OOOO O -OOOOO)

OO

OOO -O 'O/\(.*\)\([O-OO-OO-O_.+-]\{O,\}@[O-OO-OO-O_.+-\
]\{O,\}\.[O-OO-OO-O]\{O,\}\)\(.*\)/\O/O' $_OOOO >> OOOOOOOOOO

OOOO

#OO OOOO OO OOO OOO OOOO OOOOO OOO OOO OOOO \
#(OOO,OOOO...) OO OOO OOOO OOOOOO.

OOOO O

There. Perfect! Just fill in the dirs you don't want searched
and run the script and it will produce a lovely list of
email addresses, one per line, no garbage.

Hope this helps,

AC






[ Post a follow-up to this message ]



    Re: Finding all e-mail addresses in files on server.  
Alan Connor


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-04-05 07:48 AM

On comp.unix.shell, in
<1112582256.601080.108550@z14g2000cwz.googlegroups.com>,
"ifoutch@gmail.com" wrote:


> I have posted as ifoutch@yahoo.com and possibly even as
> ifoutch@hotmail.com. I am a newbie SA trying to find my way in
> my new job.
>
> The reason for needing to extract mail addresses is that
> different "admins" have created scripts that functioned as
> some sort of monitor and notification system. The problem is
> that the notification may not be going to an address that will
> be of any use anymore. So I am trying to track these down and
> either retire the scripts or change the address to something
> appropriate.
>
> -- Ian Foutch P.S. Nice manners you have when addressing
> someone you know nothing about!
>

That's the problem, fool: I don't know anything about you.

Except that you want to extract email addresses from a bunch
of files. Which is what spammers do.

Like whether you tell the truth or not on the Usenet.

And I can't search your posting history to find out, and
have no idea whether you have anything to do with any
formal organization at all.

What company do you work for? What's your name so that I
can ask them if you work there?

Are you ashamed of them? Is that why you don't use the name?

What's wrong with the RCN Corporation in Princeton N.J.?

Do they know that you are using their computers or connection?

What I do know about you is that you are hiding by changing
your alias regularly and are evasive about even that.

Like I said: XXXX Off.

AC






[ Post a follow-up to this message ]



    Re: Finding all e-mail addresses in files on server.  
Alan Connor


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-04-05 07:48 AM

On comp.unix.shell, in
<1112576768.533990.100930@z14g2000cwz.googlegroups.com>,
"ifoutch@gmail.com" wrote:

I just sent this whole thread, including all headers, to
noc@rcn.com

You had better be legit.

If you are, I'm not going to apologize because you should have
said what company you worked for and used your real name and
work email address.

I just can't figure out why _I_ would know how to do what you
want, almost off the top of my head, being only an amateur linux
user, while you, a "sysadmin", has to ask someone how to do it.

Makes no sense.

I suspect that you have gained the root password at your
workplace (or someone else's workplace) illicitly, and are doing
some very un-authorized snooping.

You sure ran like a rabbit when you found out I knew where you
were posting from. Or _through_.

Kind of late for someone in NJ to be working. Especially on
a Sunday night....

Are you a windoze cracker that finds himself lost on a
nix system?

A janitor there?

AC







[ Post a follow-up to this message ]



    Re: Finding all e-mail addresses in files on server.  
Bit Twister


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-04-05 07:48 AM

On Mon, 04 Apr 2005 03:48:18 GMT, Alan Connor wrote:
>
> If you are, I'm not going to apologize because you should have
> said what company you worked for and used your real name and
> work email address.

There is no good reason to do so.
Far too many idiots out in Usenet land.

> I just can't figure out why _I_ would know how to do what you
> want, almost off the top of my head, being only an amateur linux
> user, while you, a "sysadmin", has to ask someone how to do it.
>
> Makes no sense.

Unless you are out in the real world. Maybe the senior sysadmin was
layed off and the second team was thrown into the breach. Or
management decided to outsource the IT department and the new people
are having to scramble to understand what they signed up for.

> I suspect that you have gained the root password at your
> workplace (or someone else's workplace) illicitly, and are doing
> some very un-authorized snooping.

Well if he a totally clueless as you indicate and has managed to
gained root access, him searching for email addresses
are the least of their worries.

> Kind of late for someone in NJ to be working. Especially on
> a Sunday night....

See, you realy are totaly clueless.
When do you think sysadmins get to do whatever they like on production
systems. It sure as h*11 is not 9am Monday morning.

Friday is also a good massive layoff day to allow support people to disable
accouts, change ownership of file, copying employee files into
management directories, ...... Depending on the size of the layoff
cleanup work can still be going on come Monday morning.






[ Post a follow-up to this message ]



    Re: Finding all e-mail addresses in files on server.  
Chris F.A. Johnson


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-04-05 07:48 AM

On Mon, 04 Apr 2005 at 02:37 GMT, ifoutch@gmail.com wrote:
> I have posted as ifoutch@yahoo.com and possibly even as
> ifoutch@hotmail.com. I am a newbie SA trying to find my way in my new
> job.
>
> The reason for needing to extract mail addresses is that different
> "admins" have created scripts that functioned as some sort of monitor
> and notification system. The problem is that the notification may not
> be going to an address that will be of any use anymore. So I am trying
> to track these down and either retire the scripts or change the address
> to something appropriate.
>
> -- Ian Foutch
> P.S. Nice manners you have when addressing someone you know nothing
> about!

Don't bother responding to our resident kook. Most people here have
killfiled him.

--
Chris F.A. Johnson                  http://cfaj.freeshell.org/shell
 ========================================
===========================
Everything in moderation -- including moderation






[ Post a follow-up to this message ]



    Re: Finding all e-mail addresses in files on server.  
ifoutch@gmail.com


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-04-05 07:48 AM

Thank you BT and CJ... Actually Chris has offered extremely useful
solutions to a few of my previous posts in the past and I've much
appreciated it. I even pre-ordered his book, still waiting 

I ended up an SA because I showed some abilties with my shell scripting
while working as a NOC operator. Unfortunately without any previous
experience, schooling or training. The job is not as easy I would like.
Every task I get I have to learn it as I go and much of that ends up
during the evening on my own time.

This task sounds easy enough except that it gets messy really quick and
I dislike messy scripts. I can figure out how to use grep, find, sed,
xargs, awk, cut and whatever else need. What I am looking for is
pointers in the "best" way to do this and any advice on what I might
likely overlook.

I keep telling myself i will join a LUG in my home town (not NJ by the
way!) so that I might find a couple mentors/peers to work with. Looks
like that has become a high priority todo. People have much nicer
manners when they are face to face and they need to be concerned about
the condition of such after an exchange.

-- Ian






[ Post a follow-up to this message ]



    Re: Finding all e-mail addresses in files on server.  
Bit Twister


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
04-04-05 07:48 AM

On 3 Apr 2005 22:29:18 -0700, ifoutch@gmail.com wrote:
> Thank you BT and CJ... Actually Chris has offered extremely useful
> solutions to a few of my previous posts in the past and I've much
> appreciated it.

Yes Chris does help alot of people.

> I ended up an SA because I showed some abilties with my shell scripting
> while working as a NOC operator. Unfortunately without any previous
> experience, schooling or training. The job is not as easy I would like.

Been there done that.

> Every task I get I have to learn it as I go and much of that ends up
> during the evening on my own time.

Yes, I have take home lots of work or dialed in after getting home.


> This task sounds easy enough except that it gets messy really quick and
> I dislike messy scripts.

I find pushing the acutal work as far down into a subroutine/funmction helps
 on
messy stuff.

> I can figure out how to use grep, find, sed, xargs, awk, cut and
> whatever else need. What I am looking for is pointers in the "best"
> way to do this and any advice on what I might likely overlook.

From what you have described, I would have created the list of files
to munge. Look at the lines to be munged, and see if a small
function/subroutine can make the changes.

Then use a loop to read the list to process files into a tmp workspace
and check the results. If they are valid, backup the production
scripts into a fallback directory, and install the new ones. If
production throws up, run the fallback script to copy fallback scripts
back into production.

No way would I run a script to mass update a bunch of scripts on a
production box with my fingers crossed.

> People have much nicer manners when they are face to face and they
> need to be concerned about the condition of such after an exchange.

Never let anyone's post bother you. Watch them for awhile to see if
they are worth your time, kill file them if they are of no use.

Anytime I run into a mess/problem like yours, I'll put the variable
element into a config file, source it in a script, and use a variable in the
scripts.

As an application programmer, I put lots of tests in my scripts to
verify nodes I need, database listners, mount points
needed by my app were realy there. When a check failed, it would
create a message file, and call the nofity funcition with who to
contact, subject, filename of problem description.
Example email variable names: $dba, $sysops, $crash, $coder, $mgr,
$sysadmin, $fyi...

Notify function would then add in node, time, script name, application
and call  mailx -s "$2" $1 < $3

That reduced the O dark thirty calls to me when my production scripts
aborted because of external failures.
Also allowed me to run the scripts on the development and test
bed systems without bothering the production group by changing names
in my config file.





[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 09:22 PM.      Post New Thread    Post A Reply      
Pages (2): [1] 2 »   Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register