jbot
文件大小: unknow
源码售价: 5 个金币 积分规则     积分充值
资源说明:An Unreasonable HipChat Bot
This is a Slack version of the 'jbot' IRC bot,
originally "developed" at Yahoo! in 2007, and which
can be found in the 'old/irc' subdir.

This variant was created as a rewrite in Go for
HipChat in July 2016 by Jan Schaumann (@jschauma /
jschauma@netmeister.org).  Support for Slack was added
in July 2017.  Many thanks to Yahoo for letting me
play around with nonsense like this.

You should be able to run the bot by populating a
configuration file with suitable values.  The
following configuration values are required:

```
slackService  = the Slack service name, e.g. .slack.com
slackToken    = the authentication token for your bot
```

You may optionally also set the following
configuration values:

```
    channelFile = pathname where to store a state file
    debug = whether to enable debugging output
    opsgenieApiKey = an API key to access OpsGenie
```

This bot has a bunch of features that are company
internal; those features have been removed from
this public version.

Some day this should be extended into a pluggable
bot, so that internal code can more easily be kept
apart, I suppose.  Pull requests welcome etc.

Some of the URLs used by the bot reference simple text
documents hosted on an internal server.  This is so as
to not rely on outside resources and their flimsy
markups as well as to control the contents somewhat.
You can update the URLS map in jbot.go.

---

Interacting with the bot:

Getting jbot to join your channel:

```
/invite jbot
```

Getting jbot to leave your channel:

```
!leave
```

(Note: on Slack, bots cannot leave a channel and
require an admin to kick them.)


jbot responds to:
- commands invoked via '!command' -- see '!help'
- commands invoked via @-mentioning the bot:
  !command     => "@jbot command"
  !command arg => "@jbot command arg"

If 'chatter' is not toggled off (it is on by default),
jbot will also:
- reply to any statement that is addressed to it:
  How are you today, jbot?
  jbot, you suck

- chime in with certain semi-random replies (sure, you
  got the source, but the fun part is figuring out
  what triggers what type of response); some of these
  responses are throttled to avoid too repetitive
  annoyances

You may wish to '!toggle chatter' to turn all that
off.

All private messages to jbot are interpreted as
commands. You cannot engage in a private conversation
with jbot.

### Supported commands

The full list of public features can be seen via the
"!help" command.

The following is a list of commands supported as of
2016-09-09 with examples.

#### !8ball <question> -- ask the magic 8-ball

Ask the magic 8-ball. You get the expected reply.
E.g.:

```
16:16  !8ball is this a useful feature?
16:16  My sources say no.
```

#### !asn <hostname|ip|asn> -- display information about ASN

```
16:20  !asn www.yahoo.com
16:20  36646   | 98.138.49.66     | YAHOO-NE1 - Yahoo, US
16:20  !asn 98.138.49.66
16:20  36646   | 98.138.49.66     | YAHOO-NE1 - Yahoo, US
16:20  !asn 36646
16:20  YAHOO-NE1 - Yahoo, US
```

#### !bacon -- when you just need some more meat in your life

```
12:42  !bacon
12:42  Strip steak burgdoggen pork chop prosciutto tenderloin, brisket doner porchetta jowl pork ham hock meatloaf.
```

#### !beer -- obey your thirst

```
20:57 <@jschauma> !beer
20:57 < jbot> AleSmith Speedway Stout by AleSmith Brewing Company - 4.37
20:57 < jbot> American Double / Imperial Stout (12.00%)
20:57 < jbot> https://www.beeradvocate.com/beer/profile/396/3833/
20:58 <@jschauma> !beer bacon
20:58 < jbot> Maple Bacon Coffee Porter by Funky Buddha Brewery - 4.45
20:58 < jbot> American Porter (6.40%)
20:58 < jbot> https://www.beeradvocate.com/beer/profile/31805/62761/
```

#### !bs -- Corporate B.S. Generator

```
16:18  !bs
16:18  energistically reconceptualize real-time intellectual capital
```

#### !cert -- display information about the x509 cert found at the given hostname

This command allows you to display information about
the x509 certificate from the given host.

You can specify a hostname or an IP address followed optionally by a port. If a port is not provided, jbot will try port 443. You can also provide an optional SNI name as well as ask for the full chain: ``` 16:22 <@jans> !cert www.yahoo.com 16:22 < jbot> Serial Number: 08:88:b1:ad:2a:59:33:10:59:3f:47:56:5a:5a:5a:4a Subject : CN=*.www.yahoo.com,O=Yahoo Holdings\, Inc.,L=Sunnyvale,ST=California,C=US Issuer : CN=DigiCert SHA2 High Assurance Server CA,OU=www.digicert.com,O=DigiCert Inc,C=US Validity : Not Before: 2018-08-13 00:00:00 +0000 UTC Not After : 2019-02-14 12:00:00 +0000 UTC 44 SANs: ... 16:22 <@jans> !cert www.yahoo.com chain 16:22 < jbot> Certificate 0: Serial Number: 08:88:b1:ad:2a:59:33:10:59:3f:47:56:5a:5a:5a:4a Subject : CN=*.www.yahoo.com,O=Yahoo Holdings\, Inc.,L=Sunnyvale,ST=California,C=US ... Certificate 1: Serial Number: 04:e1:e7:a4:dc:5c:f2:f3:6d:c0:2b:42:b8:5d:15:9f Subject : CN=DigiCert SHA2 High Assurance Server CA,OU=www.digicert.com,O=DigiCert Inc,C=US ... 16:22 <@jans> !cert badssl.com extended-validation.badssl.com 16:22 < jbot> Serial Number: 03:6a:f1:d4:8f:7e:5f:22:2a:8c:45:25:f0:12:c9:e1 Subject : SERIALNUMBER=C2543436,CN=extended-validation.badssl.com,O=Mozilla Foundation,L=Mountain View,ST=California,C=US ... ``` #### !channels -- display channels I'm in ``` 16:22 !channels 16:22 I'm in the following 2 channels: 16:22 foo, bar ``` #### !clear [num] -- clear the screen / backlog Suppose you had a NSFW comment in your room, or wish to scroll an annoying gif off screen by e.g. 15 lines. You can run: ``` 16:23 !clear 15 16:23 /code ............... 16:23 .............. 16:23 ............. 16:23 ............ 16:23 ........... 16:23 .......... 16:23 ......... 16:23 ______ 16:23 < clear > 16:23 ------- 16:23 \ ^__^ 16:23 \ (oo)\_______ 16:23 (__)\ )\/\ 16:23 ||----w | 16:23 || || ``` #### !cowsay <something> -- cowsay(1) something ``` 16:25 !cowsay moo 16:25 /code _____ 16:25 < moo > 16:25 ----- 16:25 \ ^__^ 16:25 \ (oo)\_______ 16:25 (__)\ )\/\ 16:25 ||----w | 16:25 || || ``` #### !curses [<user>] -- check your curse count ``` 16:26 !curses 16:26 shit (2), fuck (1) 16:26 !curses lord 16:26 Looks like lord has been behaving so far. ``` #### !cve <cve-id> -- display vulnerability description ``` 16:27 !cve CVE-2016-5385 16:27 PHP through 7.0.8 does not attempt to address RFC 3875 section 4.1.18 namespace conflicts and therefore does not protect applications from the presence of untrusted client data in the HTTP_PROXY environment variable, which might allow remote attackers to redirect an application's outbound HTTP traffic to an arbitrary proxy server via a crafted Proxy header in an HTTP request, as demonstrated by (1) an application that 16:27 makes a getenv('HTTP_PROXY') call or (2) a CGI configuration of PHP, aka an "httpoxy" issue. 16:27 https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-5385 ``` #### !fml -- display an FML quote Note: possibly NSFW. ``` 16:28 !fml 16:28 Today, I asked my mom why she drinks. She said she only drinks when she's depressed. My step-dad said she only drinks on the weekend. Those are the days I'm at her house. FML ``` #### !fortune -- print a random, hopefully interesting, adage ``` 16:28 !fortune 16:28 Denver, n.: 16:28 A smallish city located just below the `O' in Colorado. ``` #### !help [all|<command>] -- show help ``` 10:49 !help 10:49 I know 32 commands. 10:49 Use '!help all' to show all commands. 10:49 Ask me about a specific command via '!help '. 10:49 If you find me annoyingly chatty, just '!toggle chatter'. 10:49 To ask me to leave a channel, say '!leave'. 10:50 !help help 10:50 !help [all|] -- display this help 16:28 !help all 16:28 These are commands I know: 16:28 8ball, asn, by, channels, clear, cowsay, curses, cve, fml, fortune, help, host, info, insult, jira, leave, ping, quote, rfc, room, seen, set, speb, stfu, tfln, throttle, tld, toggle, trivia, ud, unset, user, vu, weather, wtf ``` #### !host <host> -- host lookup ``` Just like host(1). 16:29 !host www.yahoo.com 16:29 www.yahoo.com is an alias for fd-fp3.wg1.b.yahoo.com. 16:29 fd-fp3.wg1.b.yahoo.com has address 98.138.49.66 16:29 fd-fp3.wg1.b.yahoo.com has IPv6 address 2001:4998:44:204::a8 ``` #### !how <command> -- show how a command is implemented ``` 11:38 !how tld 11:38 whois -h whois.iana.org ``` #### !img <something> -- fetch a link to an image Note: possibly NSFW ``` 12:49 !img avocado 12:49 http://www.buyfruit.com.au/images/P/iStock_000002972468Small_%28avocado_-_shepard%29__31894.jpg ``` #### !info <channel> -- display info about a channel ``` 16:29 !info 16:29 I was invited into #jtest by jans. 16:29 These are the users I've seen in #jtest: 16:29 jbot, jans 16:29 Top 10 channel chatterers for #jtest: 16:29 jans (69), jbot (2) 16:29 These are the toggles for this channel: 16:29 chatter => true, python => true, trivia => true 16:29 This channel is currently unthrottled. ``` #### !insult <somebody> -- insult somebody ``` 16:30 !insult Donald Trump 16:30 Donald Trump: Thou saucy unchin-snouted lout! ``` #### !jira <ticket> -- display info about a jira ticket ``` 16:02 !jira foo-123 16:02 Summary : do the foo thing 16:02 Status : Done 16:02 Created : 2016-07-30T00:06:03.000+0000 16:02 Assignee: foo 16:02 Reporter: jschauma 16:02 Link : https://jira-url/browse/foo-123 ``` #### !leave -- cause me to leave the current channel Self-explanatory, hopefully. #### !oid <oid> -- display OID information ``` 16:21 !oid 1.2.840.113549.1.1.1 16:21 ASN.1 notation: {iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs-1(1) rsaEncryption(1)} 16:21 Description: Rivest, Shamir and Adleman (RSA) encryption (and signing) 16:21 Information: Defined in IETF RFC 2313, IETF RFC 2437. See also IETF RFC 3370. 16:21 See also the equivalent but deprecated OID {joint-iso-itu-t(2) ds(5) algorithm(8) encryptionAlgorithm(1) rsa(1)}. ``` #### !oncall <group> --- show who's oncall This will attempt to look up an oncall schedule in OpsGenie. This option requires the 'opsgenieApiKey' configuration option to be set. jbot tries to be helpful and display possible groups if it can't find the on you're looking for. If you want to save yourself some typing, you can also set a default oncall group for your channel via the 'set' command. E.g.: ``` 16:06 !set 16:06 There currently are no settings for #jtest. 16:07 !oncall 16:07 No such group: jtest 16:07 !oncall jbot 16:07 No OpsGenie schedule found for 'jbot'. 16:07 Possible candidates: 16:07 JBOT_Support, JBOT_ERMAGEHRD 16:08 !oncall JBOT_Support 16:08 US: jschauma 16:08 EU: jschauma 16:08 !oncall JBOT_ERMAGEHRD 16:08 Schedule found in OpsGenie for 'JBOT_ERMAGEHRD', but nobody's currently oncall. 16:08 You can try contacting the members of team 'JBOT_ERMAGEHRD': 16:08 jschauma@netmeister.org ``` #### !ping <hostname> -- try to ping hostname ``` 16:32 !ping www.yahoo.com 16:32 www.yahoo.com is alive. ``` #### !praise [<somebody>] -- praise somebody ``` 20:43 !praise jbot 20:43 * jbot blushes. 20:43 !praise somebody 20:43 somebody: You're nicer than a day on the beach. 20:43 !praise 20:43 jbot (18), somebody (1) ``` #### !quote <symbol> -- show stock price information ``` 16:32 !quote yhoo 16:32 yhoo: 44.30 (-0.36 - -0.81%) ``` #### !rfc <rfc> -- show RFC title and URL ``` 16:33 !rfc 3514 16:33 The Security Flag in the IPv4 Header 16:33 https://tools.ietf.org/html/rfc3514 ``` #### !room <room> -- show information about the given HipChat room ``` 16:34 !room bot 16:34 No room with that exact name found. 16:34 Some possible candidates might be: 16:34 bot bot bot - bot stuff 16:34 jbot-test - test 16:34 ... 16:34 !room bot bot bot 16:34 'bot bot bot' (public) 16:34 Topic: bot stuff 16:34 Owner: jschauma 16:34 https://.hipchat.com/history/room/2906069 ``` #### !seen <user> [<channel>] -- show last time <user> was seen in <channel> jbot can only see users in channels its in. ``` 16:36 !seen alice 16:36 I have not seen that user in #jtest. 16:36 !seen bob someroom 16:36 I'm not currently in #someroom. 16:36 !seen jschauma 16:36 Thu Sep 8 20:36:54 UTC 2016 ``` #### !set [name=value] -- set 'name' to 'value' Set a channel setting. #### !speb -- show a security problem excuse bingo result ``` 16:44 !speb 16:44 You're just an academic. ``` #### !stfu [<user>] -- show channel chatterers ``` 16:44 !stfu 16:44 jans (88), bob (24), alice (13) ``` #### !tfln -- display a text from last night Note: Possibly NSFW. ``` 16:46 !tfln 16:46 I either just heard my neighbors having sex or she really agreed with whatever he was talking about. ``` #### !throttle -- show or set throttles in this channel Certain triggers only kick in unless it's previously been triggered within a given time frame. You can check which ones you're currently throttled for using this command. #### !tld [<tld>] -- display tld information ``` 17:05 !tld de 17:05 Organization: DENIC eG 17:05 Contact : vorstand@denic.de 17:05 Whois : whois.denic.de 17:05 Status : ACTIVE 17:05 Created : 1986-11-05 17:05 URL : http://www.denic.de/ ``` #### !time [location] -- show the current time (in the given location) ``` 16:59 !time 16:59 Tue Nov 1 20:59:19 UTC 2016 16:59 Tue Nov 1 16:59:19 EDT 2016 16:59 Tue Nov 1 13:59:19 PDT 2016 16:59 !time new york 16:59 Tue Nov 1 16:59:23 EDT 2016 16:59 !time taipei 16:59 Wed Nov 2 04:59:48 CST 2016 17:01 !time Portugal 17:01 Tue Nov 1 21:01:35 WET 2016 ``` #### !tld [<tld>] -- display tld information ``` 17:05 !tld de 17:05 Organization: DENIC eG 17:05 Contact : vorstand@denic.de 17:05 Whois : whois.denic.de 17:05 Status : ACTIVE 17:05 Created : 1986-11-05 17:05 URL : http://www.denic.de/ ``` #### !toggle [<feature>] -- toggle a feature Turn on or off a feature. Most useful for turning off 'chatter' (see above). #### !trivia -- show a random piece of trivia ``` 16:48 !trivia 16:48 Sleeping on the job is acceptable in Japan, as it is seen as exhaustion from working too hard. ``` #### !ud <term> -- look up a term using the Urban Dictionary (NSFW) Note: possibly NSFW ``` 16:48 !ud food 16:48 food: a substance you eat,then poop out.usually followed my a nap. 16:48 Example: hungry.....need food.... ``` #### !unset name -- unset a channel setting Unset a per-channel setting. #### !user <user>-- show information about the given HipChat user ``` 16:49 !user alice 16:49 No such user: alice 16:49 !user bob 16:49 No user with that exact name found. 16:49 Some possible candidates might be: 16:49 Bob Marley (bobc) 16:49 Bobby Tables 16:49 ... 16:52 !user 1234567 16:52 Jan Schaumann (jschauma) ``` #### !vu <num> -- display summary of a CERT vulnerability ``` 16:57 !vu 797896 16:57 CGI web servers assign Proxy header values from client requests to internal HTTP_PROXY environment variables 16:57 Web servers running in a CGI or CGI-like context may assign client request Proxy header values to internal HTTP_PROXY environment variables. This vulnerability can be leveraged to conduct man-in-the-middle (MITM) attacks on internal subrequests or to direct the server to initiate connections to arbitrary hosts. 16:57 https://www.kb.cert.org/vuls/id/797896 ``` #### !weather <location> -- show weather information ``` 16:57 !weather nyc 16:57 Conditions for New York, NY, US at 04:00 PM EDT 16:57 Today : Partly Cloudy (Low: 72; High: 86) 16:57 Tomorrow: Partly Cloudy (Low: 79; High: 90) ``` #### !whocyberedme -- show who cybered you ``` 15:27 !whocyberedme 15:27 Crowd Strike confirms: The NSA cybered you using a PEBKAC DoS. ``` #### !whois <domain> -- show whois information ``` 14:37 !whois yahoo.com 14:37 Registrar: MarkMonitor, Inc. 14:37 Registrar URL: http://www.markmonitor.com 14:37 Updated Date: 2017-06-29T11:36:33-0700 14:37 Creation Date: 1995-01-18T00:00:00-0800 14:37 Registrant Name: Domain Administrator 14:37 Registrant Organization: Yahoo! Inc. 14:37 Registrant Country: US 14:37 Registrant Email: domainadmin@yahoo-inc.com 14:37 Name Server: ns4.yahoo.com, ns2.yahoo.com, ns3.yahoo.com, ns5.yahoo.com, ns1.yahoo.com 14:37 DNSSEC: unsigned ``` #### !wtf <term> -- decrypt acronyms ``` 16:57 !wtf arp 16:57 ARP: Address Resolution Protocol ``` --- ### Requirements: Go 1.3 ### Installation: ``` make install -c -m 755 jbot /somewhere/in/your/path/jbot ``` ### Questions/comments: jschauma@netmeister.org https://twitter.com/jschauma

本源码包内暂不包含可直接显示的源代码文件,请下载源码包。