This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

private message output to user

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

private message output to user

Post by blake »

Im looking for a script that will output the contents of a private message sent to my eggdrop

im using this small bit of script at the moment but need to build on it

Code: Select all

bind msg A|A spyadd cmd:spyadd
proc cmd:spyadd {nick uhost hand arg} {
  set user1 [lindex [split $arg] 0]
  set user2 [join [lrange [split $arg] 1 end]]
  putquick "SPY add $user1 $user2"
}
When this command has been performed my eggdrop sends SPY add $user1 $user2 to the server it then gets a private message from IRC

What I need is for my eggdrop to output the content of the private message sent to it by IRC

preferably the bot will then send the user that has used the above command a private message sending that user the content of the private message sent to it by IRC
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

It would be a lot helpful if you provide information about the private message received (format) and the user@host (and nickname) of the sender.
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

Post by blake »

Sir_Fz wrote:It would be a lot helpful if you provide information about the private message received (format) and the user@host (and nickname) of the sender.
The eggdrop sends spy add nick1 nick2 to the server the eggdrop is then sent a private message by IRC then the eggdrop should send the contents of the pm from IRC to whoever has used the command spyadd nick1 nick2 showing them the contents of the private message

sorta like this I would type /changuardian spyadd user1 user2
ChanGuardian then sends spy add user1 user2 to the server
then recieves a private message from IRC
ChanGuardian then sends me a private message showing the contents of private message sent to it by IRC

user@host (IRC@hub.chattersworld.co.uk) this Changes dependent on which server this command is sent from
IRC@irc.chattersworld.co.uk
IRC@leaf.chattersworld.co.uk

IRC is whats sending the eggdrop the private message if your able to visit my server i could show you what i have and then what I want that would help more
User avatar
TCL_no_TK
Owner
Posts: 509
Joined: Fri Aug 25, 2006 7:05 pm
Location: England, Yorkshire

Post by TCL_no_TK »

:arrow: This request seems highly unethical and also violates the Forum Rules
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

@TCL_no_TK:
There might very well be ethical concerns with monitoring conversations. However, there is nothing afaik that would ban such a request on this forum in the forum rules. In the end, it all comes down to the person using this script. Also, this would not even be possible without a customized ircd for starters.. All an eggdrop would do would be to relay messages sent to the eggdrop (in theory).
NML_375
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

Post by blake »

On my server conversations are logged for security reason`s only and it do state to our users they are logged for security

reason for logging is we have users that are of an age 13 upwards conversations are only checked when requested by the user if they have had a private message sent them thats of bad content

Sorry but I do not believe theirs anything unethical about making sure our users can use our chat site and feel safe problem with most chat sites and other servers are that dont use these means are they suffer from issues with undesirable users joining the networks were teen users are if me logging a conversation means ive stopped a peadophile from grooming his next victim then im happy with that and as ive said it states to our users that all communications are logged if they choose to use our chat service that also means they are happy with our terms and guidlines

Networks use this term its unethical but they also wouldnt believe something that has been copy pasted to them as it can be edited its a shame most think more about the security of their rooms or servers and less about the ppl that make them rooms/servers a good place to use last thing I want is getting tied up in some case issues because a yougster has been groomed by some sicko and found dead.

My base reason for asking for this request is we have admin that are ircop only and do not have access to use the standalone command only network admin have this my eggdrop has network admin status because of what it does on my server this way all ircops locops will beable to use the monitoring command issued via my eggdrop all i need it do is output to them the content of the private message sent by IRC to the eggdrop
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

Blake,
Would this by any chance be the f_pmspy UnrealIRCd module by fez?
From what I could gather, the relayed message would look something like this (in RFC1459 notation):

Code: Select all

#PRIVMSG:
:IRC!IRC@irc.chattersworld.co.uk PRIVMSG Eggdrop :[Sender > Recipient] The message

#NOTICE:
:IRC!IRC@irc.chattersworld.co.uk PRIVMSG Eggdrop :[Sender - Recipient] The message
It would probably be a good idea to add a new handle for the server messaging, giving it a custom flag. This way, we can avoid non-ircd messages being forwarded or faked. There is, unfortunately, not much to build a pattern on, though a regular expression should be able to separate the sender, recipient and message without too much difficulty. All that is then left do do, is to log the message. If you don't need to separate the details, but simply

Code: Select all

if {![validuser "ircspy"]} {
  adduser ircspy "IRC!IRC@irc.chattersworld.co.uk"
  chattr ircspy +X
  setuser ircspy HOST "IRC!IRC@leaf.chattersworld.co.uk"
}

proc pubmRecvSpyMessage {nick host handle text} {
  if {[regexp -- {^\[([[:alnum:]]) ([->]) ([[:alnum:]])\] (.*)$} $text match sender type recipient message]} {
    putlog "Spy Message recieved, sender: $sender recipient: $recipient message: $message"
  }
}
bind msgm X {[*]} pubmRecvSpyMessage
For the ethical concerns, I'd leave that up to you to work out. Monitoring applications such as f_pmspy can be very useful in some cases, and easily abused in other cases. But then again, most people tend to forget that sending anything over the internet is pretty much like sending open postcards, and unless you take extra precaution to render the data unreadable by any other than the intended recipient, you always have the risk of someone "eavesdropping".
As I wrote in my previous post to TCL_no_TK, I can't see anything in your request that would violate the Forum rules.
NML_375
User avatar
Trixar_za
Op
Posts: 143
Joined: Wed Nov 18, 2009 1:44 pm
Location: South Africa
Contact:

Post by Trixar_za »

The unreal's spy module is near impossibly to find and the fact that you have it, must mean you have read ALL the text involved and warnings for it. This means you understand that the use of it is HIGHLY unethical AND HIGHLY illegal in most countries (including yours). And telling users this does not void their right of privacy.

There is no viable reason to spy on users (much less a legal one) that you can't prevent or filter by some other means. You could for example use /spamfilter to block things from your users that you don't want them to see and you can also FORCE channel modes and user modes to include +G, which will filter out any 'badwords'.

EDIT: Those that want to argue to me about this, I quote this from angrywolf's unrealircd module website:
m_spy allows you to see users' private and channel messages (both PRIVMSGs and NOTICEs) sent from anywhere on the IRC network in real time. You can redirect their messages to a channel, or they can be sent to you privately. This module provides three commands: /spy to specify whose messages you want to see, /spychan to specify which channel you want to see the messages of, and /spystats to receive statistical information about private and channel spy entries.
Note: Spying on people is highly unethical, and in many countries, illegal! Use this module at your own risk!
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

Post by blake »

nml375 wrote:Blake,
Would this by any chance be the f_pmspy UnrealIRCd module by fez?
From what I could gather, the relayed message would look something like this (in RFC1459 notation):

Code: Select all

#PRIVMSG:
:IRC!IRC@irc.chattersworld.co.uk PRIVMSG Eggdrop :[Sender > Recipient] The message

#NOTICE:
:IRC!IRC@irc.chattersworld.co.uk PRIVMSG Eggdrop :[Sender - Recipient] The message
It would probably be a good idea to add a new handle for the server messaging, giving it a custom flag. This way, we can avoid non-ircd messages being forwarded or faked. There is, unfortunately, not much to build a pattern on, though a regular expression should be able to separate the sender, recipient and message without too much difficulty. All that is then left do do, is to log the message. If you don't need to separate the details, but simply

Code: Select all

if {![validuser "ircspy"]} {
  adduser ircspy "IRC!IRC@irc.chattersworld.co.uk"
  chattr ircspy +X
  setuser ircspy HOST "IRC!IRC@leaf.chattersworld.co.uk"
}

proc pubmRecvSpyMessage {nick host handle text} {
  if {[regexp -- {^\[([[:alnum:]]) ([->]) ([[:alnum:]])\] (.*)$} $text match sender type recipient message]} {
    putlog "Spy Message recieved, sender: $sender recipient: $recipient message: $message"
  }
}
bind msgm X {[*]} pubmRecvSpyMessage
For the ethical concerns, I'd leave that up to you to work out. Monitoring applications such as f_pmspy can be very useful in some cases, and easily abused in other cases. But then again, most people tend to forget that sending anything over the internet is pretty much like sending open postcards, and unless you take extra precaution to render the data unreadable by any other than the intended recipient, you always have the risk of someone "eavesdropping".
As I wrote in my previous post to TCL_no_TK, I can't see anything in your request that would violate the Forum rules.
Im using angrywolfs m_spy.c module for unrealircd

i respect the views everyone have left it is not illegal in the uk infact the home office welcome such actions on security with regards to chat sites and games sites

Code: Select all

privmsg
<IRC> [Malphas >> ChanGuardian] hello
this is how it outputs to a private message to the bot
User avatar
Trixar_za
Op
Posts: 143
Joined: Wed Nov 18, 2009 1:44 pm
Location: South Africa
Contact:

Post by Trixar_za »

No, that only pertains to Govermental Powers and the Police... Are you either? No? Then you're perpetrating human right violations and SEVERAL of your countries laws (both of which your users can sue you for...).

The only other exception to this law would be if you owned the equipment you are monitoring and the users were your employees.

Also try to download m_spy.c from angrywolf's website - you can't and he doesn't provide it anymore with, what I feel, is very good reasons.

Even worse you're going to give local IRCop's the power to monitor people, what keeps them from abusing this and monitoring people without any good reason or selling or abusing the information they get from this (this can end up violating the Data Protection Act). The probability for abuse gets worse the more people have access to this command.

But like angrywolf said - use it at your own risk and remember, with me telling you all this, you can't claim ignorance when things go wrong. I did my ethical part now (and my human right #29 and yours [Where I have a obligation to tell you these things]) and I won't bother you any futher.
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

blake:
In that case, the regular expression would be like this:

Code: Select all

  if {[regexp -- {^\[([[:alnum:]]) >> ([[:alnum:]])\] (.*)$} $text match sender recipient message]} {
NML_375
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

Post by blake »

My eggdrop is now recieving the messages form IRC but is not outputting them to a private message

This is on bots partyline

Code: Select all

<ChanGuardian> [12:35] Tcl error [cmd:spyadd]: No such info type: HOST
_-12:35pm-_ <ChanGuardian> [12:35] -NOTICE- *** ChanGuardian Malphas: Added to your private spy list
_-12:35pm-_ <ChanGuardian> [12:36] [IRC!IRC@hub.chattersworld.co.uk] [Malphas >> ChanGuardian] hello
Tcl below


Code: Select all

bind msg A|A spyadd cmd:spyadd
bind msg A|A spydel cmd:spydel

proc cmd:spyadd {nick uhost hand arg} {
  set user1 [lindex [split $arg] 0]
  set user2 [join [lrange [split $arg] 1 end]]
  putquick "SPY add $user1 $user2"
  if {![validuser "IRC"]} {
  adduser IRC "IRC!IRC@irc.chattersworld.co.uk"
  chattr IRC +A
  setuser IRC HOST "IRC!IRC@leaf.chattersworld.co.uk"
}
proc pubm RecvSpyMessage {nick host handle text} {
  if {[regexp -- {^\[([[:alnum:]]) >> ([[:alnum:]])\] (.*)$} $text match sender recipient message]} {
    putlog "Spy Message recieved, sender: $sender recipient: $recipient message: $message"
  }
}
bind msgm A pubm:RecvSpyMessage
}
  proc cmd:spydel {nick uhost hand arg} {
  set user1 [lindex [split $arg] 0]
  set user2 [join [lrange [split $arg] 1 end]]
  putquick "SPY del $user1 $user2"
  puthelp "PRIVMSG $nick No Longer Logging $user1 & $user2"
}
All working just not sendining the private message to me or whoever has requested the command
n
nml375
Revered One
Posts: 2860
Joined: Fri Aug 04, 2006 2:09 pm

Post by nml375 »

First off, you should'nt use the same flag for the server record as for the ones trusted with the spyadd/spydel commands. We want a specific flag that identifies the servers uniquely, so that none may fake a logged message.

Next, the test for whether the IRC handle exists or not, and the subsequent adding of the record (if missing) was not intended to be added to any proc, but just a failsafe to make sure the user record gets created as the script loads. You could use it within the spyadd proc, but you'll need to keep your braces balanced (properly indenting the code helps getting this right).

Further, you you've added "pubm" and a space (typo?) in the name of the RecvSpyMessage proc. Having spaces in proc names is a very, very bad idea. Further, the command you added to the binding does not match this command name. You've also forgot to include the "mask" argument in the bind declaration.

Now to the logged error. I made a slight typo in the code that adds the new user record, HOST should really be HOSTS on the line starting with "setuser".

Corrected version of the code I posted earlier, also renamed the pubmRecvSpyMessage proc to RecvSpyMessage, as the previous name was misleading (bind declaration updated accordingly):

Code: Select all

if {![validuser "ircspy"]} {
  adduser ircspy "IRC!IRC@irc.chattersworld.co.uk"
  chattr ircspy +X
  setuser ircspy HOSTS "IRC!IRC@leaf.chattersworld.co.uk"
}

proc RecvSpyMessage {nick host handle text} {
  if {[regexp -- {^\[([[:alnum:]]) ([->]) ([[:alnum:]])\] (.*)$} $text match sender type recipient message]} {
    putlog "Spy Message recieved, sender: $sender recipient: $recipient message: $message"
  }
}
bind msgm X {[*]} RecvSpyMessage
Now, be careful when you add this code. You cannot insert it inside any of your already existing procs, but it must be "outside" them.
NML_375
b
blake
Master
Posts: 201
Joined: Mon Feb 23, 2009 9:42 am
Contact:

Post by blake »

Still not outputting im guessing its not recognising the ircspy as its not a user its more irc related messages just being sent in a private message ive typed RecvSpyMessage nothing messages are still going to bots partyline just no output


Rehash bot get this
_-6:06pm-_ <ChanGuardian> [18:07] * Duplicate user record 'ircspy'!
_-6:06pm-_ <ChanGuardian> [18:07] Userfile loaded, unpacking...
_-6:07pm-_ <Malphas> .whois ircspy
_-6:07pm-_ <ChanGuardian> [18:07] #Malphas# whois ircspy
_-6:07pm-_ <ChanGuardian> HANDLE PASS NOTES FLAGS LAST
_-6:07pm-_ <ChanGuardian> ircspy no 0 fhlopX never (nowhere)
_-6:07pm-_ <ChanGuardian> HOSTS: IRC!IRC@hub.chattersworld.co.uk

Should I change ircspy to just IRC
User avatar
speechles
Revered One
Posts: 1398
Joined: Sat Aug 26, 2006 10:19 pm
Location: emerald triangle, california (coastal redwoods)

Post by speechles »

Something such as what is below should work. This copies all the advice given above, as well as adding a routine to message all the users who are +A the messages, rather than putlogging them.

Code: Select all

bind msg A|A spyadd cmd:spyadd
bind msg A|A spydel cmd:spydel
bind msgm X {[*]} RecvSpyMessage

if {![validuser "ircspy"]} {
  adduser ircspy "IRC!IRC@irc.chattersworld.co.uk"
  chattr ircspy +X
  setuser ircspy HOSTS "IRC!IRC@leaf.chattersworld.co.uk"
  setuser ircspy HOSTS "IRC!IRC@hub.chattersworld.co.uk"
} 

proc RecvSpyMessage {nick host handle text} {
  if {[regexp -- {^\[([[:alnum:]]) >> ([[:alnum:]])\] (.*)$} $text match sender recipient message]} {
    putspyGuys "@ <$sender -> $recipient> $message"
  }
}

proc putspyGuys {message} {
  if {[llength [userlist A|A]]} {
    foreach guy [userlist A|A] {
      puthelp "privmsg $guy :$message"
    }
  }
}

proc cmd:spyadd {nick uhost hand arg} {
  if {[llength [split $arg]] !=2} {
    puthelp "privmsg $nick :sender or recipient missing (or your being silly, try again. :P)"
    return
  }
  set user1 [lindex [split $arg] 0]
  set user2 [lindex [split $arg] 1]
  putquick "SPY add $user1 $user2"
  putspyGuys "+++> $nick has spy added: $user1 -> $user2"
}

proc cmd:spydel {nick uhost hand arg} {
  if {[llength [split $arg]] !=2} {
    puthelp "privmsg $nick :sender or recipient missing (or your being silly, try again. :P)"
    return
  }
  set user1 [lindex [split $arg] 0]
  set user2 [lindex [split $arg] 1]
  putquick "SPY del $user1 $user2"
  putspyGuys "---> $nick has spy deleted: $user1 -> $user2"
} 
Last edited by speechles on Sun Dec 20, 2009 2:30 pm, edited 1 time in total.
Post Reply