3

I'm writing an IRC bot in python and I don't have a clear idea on how I'm supposed to implement command substitution. Currently, if the bot sees a public message starting with an exclamation mark, it searches for a function with the name after the exclamation mark and calls it with the given parameters. For example, if I send it a message with the text "!ddg 123", it makes a DuckDuckGo search with the query "123". My goal would be to be able to do things like "!ddg !(random 100)", which would generate a random number and search it on DDG. Also, some weird things like "!ddg !(random !(random 100))abc!(random 50)" => DDG search for "23abc44".

  • This seems dangerous. You're asking to evaluate the data given to you on irc by random users. How would you de-taint the input? – jane arc Jan 29 '14 at 22:11

0 Answers0