├── README.md ├── config.py ├── deps.txt ├── log └── redis.log ├── pip.req ├── redis.conf ├── run.py ├── scripts ├── close_botnet.sh ├── kill_autossh.sh ├── open_botnet.sh └── terminate.sh └── sentrygund ├── __init__.py ├── models.py ├── redis_monitor.py ├── static ├── css │ ├── images │ │ └── ajax-loader.gif │ ├── jquery-ui.css │ ├── jquery.mobile-1.4.2.min.css │ └── sentrygund │ │ └── global.css ├── img │ └── stub └── js │ ├── jquery-1.10.2.min.js │ ├── jquery-ui.js │ ├── jquery.mobile-1.4.2.min.js │ ├── jquery.sidebar.js │ ├── jquery.sidebar.min.js │ ├── sentrygund │ ├── event_handlers.js │ └── main.js │ └── socket.io.min.js ├── templates ├── head.html ├── header.html ├── index.html ├── map.html └── settings.html ├── utils.py └── views.py /README.md: -------------------------------------------------------------------------------- 1 | # sentrygun-server 2 | 3 | This is the github repo for sentrygun-server. For the sentrygun sensor component, please see https://github.com/s0lst1c3/sentrygun 4 | 5 | Sentrygun is an open source toolkit for detecting and responding to evil twin and karma attacks. It is capable of identifying evil twin attacks using whitelisting and listening for anomalies in signal strength. It is capable of detecting karma attacks by deliberately sending out probe requests for randomized ESSIDs then comparing the responses. 6 | 7 | A sentrygun installation consists of an array of sensors arranged in a grid that communicate with a command and control server. The sensor units analyze wireless traffic to detect nearby evil twin and karma attacks, and report results back to the server. When an evil twin or karma attack is detected, an alert is displayed in sentrygun's web frontend. Network administrators can then take steps to locate the attack, or use sentrygun to launch counterattacks against the offending rogue AP. 8 | 9 | Want to contribute to sentrygun? Make a pull request, or contact labs@gdssecurity.com. 10 | 11 | #Key Features 12 | 13 | - Capable of detecting karma attacks based on probe request/response patterns 14 | - Capable of detecting evil twin attacks through the use of whitelist crossreferencing 15 | - Capable of detecting evil twin attacks by identifying anomalies in signal strength 16 | - Assists network administrators in determining physical location of rogue AP attack 17 | - Capable of launching counterattacks against rogue access points 18 | 19 | #Upcoming Features 20 | 21 | - machine learning based approach to evil twin detection 22 | - identification of behaviors typically used by rogue APs to evade detection 23 | - identification of rogue APs through the use of WiFi canaries 24 | 25 | #Full Setup 26 | 27 | These are the full installation instructions for a rogue AP detection system using sentrygun and sentrygun-server. For instructions on how to use sentrygun after completing steps 1 through 5, please see the "Usage" section below. 28 | 29 | ##Step 1 - sentrygun sensor setup 30 | 31 | A sentrygun sensor can be built using any device that meets the following requirements: 32 | 33 | - supports a modern 64 bit Linux operating system 34 | - has an ethernet adapter 35 | - can power an external wireless adapter such as the TP-Link TL-WN722N. 36 | 37 | A good candidate for building a sentrygun sensor is the Raspberry Pi microcomputer. 38 | 39 | Additionally, each sentrygun sensor requires an external dual band wireless adapter capable 40 | of packet injection and monitor mode. 41 | 42 | To build a sentrygun sensor unit: 43 | 44 | 1. install linux operating system on device 45 | 2. download sentrygun using the following command 46 | 47 | git clone https://github.com/s0lst1c3/sentrygun.git 48 | 49 | 3. in the newly created sentrygun directory, install python dependencies using pip 50 | 51 | pip install -r pip.req 52 | 53 | 4. connect external wireless adapter to the device 54 | 55 | ##Step 2 - sentrygun-server setup 56 | 57 | The machine running sentrygun's server component can be anything from a laptop to a rackmount machine. Any machine can be used so long as it meets the following requirements: 58 | 59 | - is provisioned with a modern 64 bit Linux operating system 60 | - is capable of running sentrygun's software dependencies 61 | - is capable of connecting to an ethernet network 62 | 63 | To setup sentrygun-server on your machine of choice, first install the following software dependencies: 64 | 65 | dnf install gcc redhat-rpm-config python-devel autossh redis 66 | 67 | Then install the python dependencies enumerated in the pip.req file included with the project: 68 | 69 | pip install -r pip.req 70 | 71 | ##Step 3 - network setup 72 | 73 | sentrygun sensors should be arranged in a grid across the area that they are responsible for protecting. For example, to add rogue AP protection to a warehouse: 74 | 75 | ![alt tag](https://raw.githubusercontent.com/s0lst1c3/sentrygun/docs/docs/img/sentrygun-grid.png) 76 | 77 | The sensors should be connected to the machine running sentrygun-server over a phsyical network connection. Preferably, this connection should occur over an ethernet connection only accessible to network administrators (i.e. management network). 78 | 79 | ##Step 4 - Calibrate sentrygun sensors 80 | 81 | sentrygun sensor devices must be calibrated against your wireless network if evil twin detection is to be enabled. To calibrate the clients, populate the whitelist.txt file on each of your sensor devices with the bssid and essid of each access point on your network. The access points should be listed in whitelist.txt using the following format. 82 | 83 | # essid bssid 84 | gdslabs ff:ff:ff:aa:aa:aa 85 | gdslabs 00:11:22:33:44:00 86 | gdslabs 00:11:22:33:44:55 87 | 88 | # and so on and so forth 89 | 90 | Next, run sentrygun's calibration routine using the provided sg-calibrator.py script. The syntax for using sg-calibrator.py is as follows: 91 | 92 | python sg-calibrator.py -i IFACE 93 | 94 | Substitute IFACE with the name of the device's external wireless interface. The specified wireless interface should be in monitor mode. 95 | 96 | The sg-calibrator.py script will collect packets from your wireless access points over a period of time. It will then calculate the mean tx value across all packets collected. Finally, sg-calibrator.py will set a low and high bound equal to plus or minus N times the maximum deviation from the mean tx, where N is the value specified in configs.py. 97 | 98 | It is imperative that sg-calibrator.py is run in a physically secure environment to prevent statistical poisoning attacks. Sentrygun's evil twin detection relies on detecting tx values that fall outside of an expected threshold. An attacker could render this functionality useless by broadcasting their own tx values during the calibration phase. 99 | 100 | Once all devices have been calibrated, we can proceed to step 4 to initialize the system. 101 | 102 | ##Step 5 - Run System 103 | 104 | To run the sentrygun system, first start the sentrygun-server instance by issuing the following command on the CnC machine: 105 | 106 | python run.py 107 | 108 | sentrygun-server accepts the following command line arguments. 109 | 110 | - --port - specifies the port on which sentrygun-server should listen (defaults to 80) 111 | - --host - specifies the address at which sentrygun-server should listen (defaults to 0.0.0.0 if --tunnels flag is not used. Defaults to 127.0.0.1 if --tunnels flag is used). 112 | - --debug - Run in debug mode (not recommended for production environments) 113 | - --expire - Sets the number of seconds that alerts should remain active before they are automatically dismissed. To disable alert expiration, set this to 0 (default). 114 | - --tunnels - Creates ssh tunnels from localhost:PORT on sentrygun-server to localhost:PORT on a list of sentrygun clients, where PORT is the port at which sentrygun-server listens on. When this flag is used, sentrygun-server will always listen on localhost regardless of whether the --host is used. Use this option when running sentrygun on a hostle network (you should assume that you are). sentrysun clients should be specified with the format user@host:port. 115 | 116 | Once the server is running, start up each of the sentrygun sensor instances using the following syntax: 117 | 118 | python sentrygun.py 119 | 120 | sentrygun.py accepts the following command line arguments: 121 | 122 | - -a SERVER_ADDRESS - connect to sentrygun-server CnC at address SERVER_ADDRESS 123 | - -p SERVER_PORT - connect to sentrygun-server CnC on port SERVER_PORT 124 | - --evil-twin - enable evil-twin detection 125 | - --karma - enable karma attack detection 126 | - -i IFACE - substitute IFACE with name of external wireless interface (should be in monitor mode) 127 | 128 | For example, to enable evil-twin and karma detection with server located at example.com:4444 use the following command: 129 | 130 | python sentrygun.py -i wlan1 -p 4444 -a example.com --evil-twin --karma 131 | 132 | In the above example, the wireless interface is named wlan1. 133 | 134 | #Usage Instructions 135 | 136 | Once the system is up and running, navigate to the address and port at which the sentrygun-server instance is running. For example, if we started sentrygun-server at 192.168.1.39:4444 in step 4 of the setup instructions, we would navigate to the following address in our browser: 137 | 138 | http://192.168.1.39:4444 139 | 140 | You should be presented with a blank screen labeled "SentryGun Dashboard". There will also be an expandable toolbar on the left with links to features that have not been implemented yet. 141 | 142 | ![alt tag](https://raw.githubusercontent.com/s0lst1c3/sentrygun/docs/docs/img/sentrygun-blank.png) 143 | 144 | When a rogue access point attack is detected by one or more sentrygun sensor devices, an alert will appear instantly on the dashboard as shown below. 145 | 146 | ![alt tag](https://raw.githubusercontent.com/s0lst1c3/sentrygun/docs/docs/img/sentrygun-new.png) 147 | 148 | Each alert corresponds to an active Rogue AP attack against your network. Clicking an alert will reveal a list of all devices currently detecting the attack, as shown below. 149 | 150 | ![alt tag](https://raw.githubusercontent.com/s0lst1c3/sentrygun/docs/docs/img/sentrygun-alert.png) 151 | 152 | The list of alerting devices is sorted by distance and signal strength. This allows you to begin locating the source of the attack, as the rogue AP is closest to the sensor displayed at the top of the list. 153 | 154 | Located at the bottom of each alert list is a toolbar that can be used to dismiss alerts as well as launch counterattacks against the rogue access points. The available actions shown in the toolbar are as follows: 155 | 156 | - Locate - Displays a heat map to help locate the source of the attack (not implemented yet) 157 | - Deauth - Causes all sensor devices to flood the offending rogue AP with deauth packets 158 | - Napalm - Physically degrade offending rogue AP using flooding attack (not implemented yet) 159 | - Dismiss - Manually dismiss the alert and cease all counterattacks against offending rogue AP. 160 | 161 | To perform one of these actions: 162 | 163 | 1. click the action by name in the toolbar 164 | 2. click submit 165 | -------------------------------------------------------------------------------- /config.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | ''' 3 | File: config.py 4 | Author: Gabriel Ryan 5 | Email: gryan@gdssecurity.com 6 | Source: http://github.com/s0lst1c3/sentrygun_server 7 | 8 | Description: Flask config file 9 | 10 | ''' 11 | 12 | # namespace for web interface 13 | SOCKETIO_NS='/watchdog' 14 | 15 | # namespace for sensor clients 16 | LISTENER_NS='/punisher' 17 | 18 | # identity file for ssh connections 19 | IDENTITY_FILE='/root/.ssh/id_rsa' 20 | -------------------------------------------------------------------------------- /deps.txt: -------------------------------------------------------------------------------- 1 | #fedora 2 | gcc 3 | redhat-rpm-config 4 | python-devel 5 | autossh 6 | -------------------------------------------------------------------------------- /log/redis.log: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/s0lst1c3/sentrygun-server/cbbfcafa0356d80c327490ff1dae528219a3efa8/log/redis.log -------------------------------------------------------------------------------- /pip.req: -------------------------------------------------------------------------------- 1 | Flask 2 | Flask-SocketIO 3 | mmh3 4 | redis 5 | requests >= 2.4.2 6 | -------------------------------------------------------------------------------- /redis.conf: -------------------------------------------------------------------------------- 1 | # Redis configuration file example. 2 | # 3 | # Note that in order to read the configuration file, Redis must be 4 | # started with the file path as first argument: 5 | # 6 | # ./redis-server /path/to/redis.conf 7 | 8 | # Note on units: when memory size is needed, it is possible to specify 9 | # it in the usual form of 1k 5GB 4M and so forth: 10 | # 11 | # 1k => 1000 bytes 12 | # 1kb => 1024 bytes 13 | # 1m => 1000000 bytes 14 | # 1mb => 1024*1024 bytes 15 | # 1g => 1000000000 bytes 16 | # 1gb => 1024*1024*1024 bytes 17 | # 18 | # units are case insensitive so 1GB 1Gb 1gB are all the same. 19 | 20 | ################################## INCLUDES ################################### 21 | 22 | # Include one or more other config files here. This is useful if you 23 | # have a standard template that goes to all Redis servers but also need 24 | # to customize a few per-server settings. Include files can include 25 | # other files, so use this wisely. 26 | # 27 | # Notice option "include" won't be rewritten by command "CONFIG REWRITE" 28 | # from admin or Redis Sentinel. Since Redis always uses the last processed 29 | # line as value of a configuration directive, you'd better put includes 30 | # at the beginning of this file to avoid overwriting config change at runtime. 31 | # 32 | # If instead you are interested in using includes to override configuration 33 | # options, it is better to use include as the last line. 34 | # 35 | # include /path/to/local.conf 36 | # include /path/to/other.conf 37 | 38 | ################################ GENERAL ##################################### 39 | 40 | # By default Redis does not run as a daemon. Use 'yes' if you need it. 41 | # Note that Redis will write a pid file in /var/run/redis.pid when daemonized. 42 | daemonize yes 43 | 44 | # When running daemonized, Redis writes a pid file in /var/run/redis.pid by 45 | # default. You can specify a custom pid file location here. 46 | pidfile ./redis.pid 47 | 48 | # Accept connections on the specified port, default is 6379. 49 | # If port 0 is specified Redis will not listen on a TCP socket. 50 | port 6379 51 | 52 | # TCP listen() backlog. 53 | # 54 | # In high requests-per-second environments you need an high backlog in order 55 | # to avoid slow clients connections issues. Note that the Linux kernel 56 | # will silently truncate it to the value of /proc/sys/net/core/somaxconn so 57 | # make sure to raise both the value of somaxconn and tcp_max_syn_backlog 58 | # in order to get the desired effect. 59 | tcp-backlog 511 60 | 61 | # By default Redis listens for connections from all the network interfaces 62 | # available on the server. It is possible to listen to just one or multiple 63 | # interfaces using the "bind" configuration directive, followed by one or 64 | # more IP addresses. 65 | # 66 | # Examples: 67 | # 68 | # bind 192.168.1.100 10.0.0.1 69 | bind 127.0.0.1 70 | 71 | # Specify the path for the Unix socket that will be used to listen for 72 | # incoming connections. There is no default, so Redis will not listen 73 | # on a unix socket when not specified. 74 | # 75 | # unixsocket /tmp/redis.sock 76 | # unixsocketperm 700 77 | 78 | # Close the connection after a client is idle for N seconds (0 to disable) 79 | timeout 0 80 | 81 | # TCP keepalive. 82 | # 83 | # If non-zero, use SO_KEEPALIVE to send TCP ACKs to clients in absence 84 | # of communication. This is useful for two reasons: 85 | # 86 | # 1) Detect dead peers. 87 | # 2) Take the connection alive from the point of view of network 88 | # equipment in the middle. 89 | # 90 | # On Linux, the specified value (in seconds) is the period used to send ACKs. 91 | # Note that to close the connection the double of the time is needed. 92 | # On other kernels the period depends on the kernel configuration. 93 | # 94 | # A reasonable value for this option is 60 seconds. 95 | tcp-keepalive 0 96 | 97 | # Specify the server verbosity level. 98 | # This can be one of: 99 | # debug (a lot of information, useful for development/testing) 100 | # verbose (many rarely useful info, but not a mess like the debug level) 101 | # notice (moderately verbose, what you want in production probably) 102 | # warning (only very important / critical messages are logged) 103 | loglevel notice 104 | 105 | # Specify the log file name. Also the empty string can be used to force 106 | # Redis to log on the standard output. Note that if you use standard 107 | # output for logging but daemonize, logs will be sent to /dev/null 108 | logfile ./log/redis.log 109 | 110 | # To enable logging to the system logger, just set 'syslog-enabled' to yes, 111 | # and optionally update the other syslog parameters to suit your needs. 112 | # syslog-enabled no 113 | 114 | # Specify the syslog identity. 115 | # syslog-ident redis 116 | 117 | # Specify the syslog facility. Must be USER or between LOCAL0-LOCAL7. 118 | # syslog-facility local0 119 | 120 | # Set the number of databases. The default database is DB 0, you can select 121 | # a different one on a per-connection basis using SELECT where 122 | # dbid is a number between 0 and 'databases'-1 123 | databases 16 124 | 125 | ################################ SNAPSHOTTING ################################ 126 | # 127 | # Save the DB on disk: 128 | # 129 | # save 130 | # 131 | # Will save the DB if both the given number of seconds and the given 132 | # number of write operations against the DB occurred. 133 | # 134 | # In the example below the behaviour will be to save: 135 | # after 900 sec (15 min) if at least 1 key changed 136 | # after 300 sec (5 min) if at least 10 keys changed 137 | # after 60 sec if at least 10000 keys changed 138 | # 139 | # Note: you can disable saving completely by commenting out all "save" lines. 140 | # 141 | # It is also possible to remove all the previously configured save 142 | # points by adding a save directive with a single empty string argument 143 | # like in the following example: 144 | # 145 | # save "" 146 | 147 | save 900 1 148 | save 300 10 149 | save 60 10000 150 | 151 | # By default Redis will stop accepting writes if RDB snapshots are enabled 152 | # (at least one save point) and the latest background save failed. 153 | # This will make the user aware (in a hard way) that data is not persisting 154 | # on disk properly, otherwise chances are that no one will notice and some 155 | # disaster will happen. 156 | # 157 | # If the background saving process will start working again Redis will 158 | # automatically allow writes again. 159 | # 160 | # However if you have setup your proper monitoring of the Redis server 161 | # and persistence, you may want to disable this feature so that Redis will 162 | # continue to work as usual even if there are problems with disk, 163 | # permissions, and so forth. 164 | stop-writes-on-bgsave-error yes 165 | 166 | # Compress string objects using LZF when dump .rdb databases? 167 | # For default that's set to 'yes' as it's almost always a win. 168 | # If you want to save some CPU in the saving child set it to 'no' but 169 | # the dataset will likely be bigger if you have compressible values or keys. 170 | rdbcompression yes 171 | 172 | # Since version 5 of RDB a CRC64 checksum is placed at the end of the file. 173 | # This makes the format more resistant to corruption but there is a performance 174 | # hit to pay (around 10%) when saving and loading RDB files, so you can disable it 175 | # for maximum performances. 176 | # 177 | # RDB files created with checksum disabled have a checksum of zero that will 178 | # tell the loading code to skip the check. 179 | rdbchecksum yes 180 | 181 | # The filename where to dump the DB 182 | dbfilename dump.rdb 183 | 184 | # The working directory. 185 | # 186 | # The DB will be written inside this directory, with the filename specified 187 | # above using the 'dbfilename' configuration directive. 188 | # 189 | # The Append Only File will also be created inside this directory. 190 | # 191 | # Note that you must specify a directory here, not a file name. 192 | dir /var/lib/redis/ 193 | 194 | ################################# REPLICATION ################################# 195 | 196 | # Master-Slave replication. Use slaveof to make a Redis instance a copy of 197 | # another Redis server. A few things to understand ASAP about Redis replication. 198 | # 199 | # 1) Redis replication is asynchronous, but you can configure a master to 200 | # stop accepting writes if it appears to be not connected with at least 201 | # a given number of slaves. 202 | # 2) Redis slaves are able to perform a partial resynchronization with the 203 | # master if the replication link is lost for a relatively small amount of 204 | # time. You may want to configure the replication backlog size (see the next 205 | # sections of this file) with a sensible value depending on your needs. 206 | # 3) Replication is automatic and does not need user intervention. After a 207 | # network partition slaves automatically try to reconnect to masters 208 | # and resynchronize with them. 209 | # 210 | # slaveof 211 | 212 | # If the master is password protected (using the "requirepass" configuration 213 | # directive below) it is possible to tell the slave to authenticate before 214 | # starting the replication synchronization process, otherwise the master will 215 | # refuse the slave request. 216 | # 217 | # masterauth 218 | 219 | # When a slave loses its connection with the master, or when the replication 220 | # is still in progress, the slave can act in two different ways: 221 | # 222 | # 1) if slave-serve-stale-data is set to 'yes' (the default) the slave will 223 | # still reply to client requests, possibly with out of date data, or the 224 | # data set may just be empty if this is the first synchronization. 225 | # 226 | # 2) if slave-serve-stale-data is set to 'no' the slave will reply with 227 | # an error "SYNC with master in progress" to all the kind of commands 228 | # but to INFO and SLAVEOF. 229 | # 230 | slave-serve-stale-data yes 231 | 232 | # You can configure a slave instance to accept writes or not. Writing against 233 | # a slave instance may be useful to store some ephemeral data (because data 234 | # written on a slave will be easily deleted after resync with the master) but 235 | # may also cause problems if clients are writing to it because of a 236 | # misconfiguration. 237 | # 238 | # Since Redis 2.6 by default slaves are read-only. 239 | # 240 | # Note: read only slaves are not designed to be exposed to untrusted clients 241 | # on the internet. It's just a protection layer against misuse of the instance. 242 | # Still a read only slave exports by default all the administrative commands 243 | # such as CONFIG, DEBUG, and so forth. To a limited extent you can improve 244 | # security of read only slaves using 'rename-command' to shadow all the 245 | # administrative / dangerous commands. 246 | slave-read-only yes 247 | 248 | # Replication SYNC strategy: disk or socket. 249 | # 250 | # ------------------------------------------------------- 251 | # WARNING: DISKLESS REPLICATION IS EXPERIMENTAL CURRENTLY 252 | # ------------------------------------------------------- 253 | # 254 | # New slaves and reconnecting slaves that are not able to continue the replication 255 | # process just receiving differences, need to do what is called a "full 256 | # synchronization". An RDB file is transmitted from the master to the slaves. 257 | # The transmission can happen in two different ways: 258 | # 259 | # 1) Disk-backed: The Redis master creates a new process that writes the RDB 260 | # file on disk. Later the file is transferred by the parent 261 | # process to the slaves incrementally. 262 | # 2) Diskless: The Redis master creates a new process that directly writes the 263 | # RDB file to slave sockets, without touching the disk at all. 264 | # 265 | # With disk-backed replication, while the RDB file is generated, more slaves 266 | # can be queued and served with the RDB file as soon as the current child producing 267 | # the RDB file finishes its work. With diskless replication instead once 268 | # the transfer starts, new slaves arriving will be queued and a new transfer 269 | # will start when the current one terminates. 270 | # 271 | # When diskless replication is used, the master waits a configurable amount of 272 | # time (in seconds) before starting the transfer in the hope that multiple slaves 273 | # will arrive and the transfer can be parallelized. 274 | # 275 | # With slow disks and fast (large bandwidth) networks, diskless replication 276 | # works better. 277 | repl-diskless-sync no 278 | 279 | # When diskless replication is enabled, it is possible to configure the delay 280 | # the server waits in order to spawn the child that transfers the RDB via socket 281 | # to the slaves. 282 | # 283 | # This is important since once the transfer starts, it is not possible to serve 284 | # new slaves arriving, that will be queued for the next RDB transfer, so the server 285 | # waits a delay in order to let more slaves arrive. 286 | # 287 | # The delay is specified in seconds, and by default is 5 seconds. To disable 288 | # it entirely just set it to 0 seconds and the transfer will start ASAP. 289 | repl-diskless-sync-delay 5 290 | 291 | # Slaves send PINGs to server in a predefined interval. It's possible to change 292 | # this interval with the repl_ping_slave_period option. The default value is 10 293 | # seconds. 294 | # 295 | # repl-ping-slave-period 10 296 | 297 | # The following option sets the replication timeout for: 298 | # 299 | # 1) Bulk transfer I/O during SYNC, from the point of view of slave. 300 | # 2) Master timeout from the point of view of slaves (data, pings). 301 | # 3) Slave timeout from the point of view of masters (REPLCONF ACK pings). 302 | # 303 | # It is important to make sure that this value is greater than the value 304 | # specified for repl-ping-slave-period otherwise a timeout will be detected 305 | # every time there is low traffic between the master and the slave. 306 | # 307 | # repl-timeout 60 308 | 309 | # Disable TCP_NODELAY on the slave socket after SYNC? 310 | # 311 | # If you select "yes" Redis will use a smaller number of TCP packets and 312 | # less bandwidth to send data to slaves. But this can add a delay for 313 | # the data to appear on the slave side, up to 40 milliseconds with 314 | # Linux kernels using a default configuration. 315 | # 316 | # If you select "no" the delay for data to appear on the slave side will 317 | # be reduced but more bandwidth will be used for replication. 318 | # 319 | # By default we optimize for low latency, but in very high traffic conditions 320 | # or when the master and slaves are many hops away, turning this to "yes" may 321 | # be a good idea. 322 | repl-disable-tcp-nodelay no 323 | 324 | # Set the replication backlog size. The backlog is a buffer that accumulates 325 | # slave data when slaves are disconnected for some time, so that when a slave 326 | # wants to reconnect again, often a full resync is not needed, but a partial 327 | # resync is enough, just passing the portion of data the slave missed while 328 | # disconnected. 329 | # 330 | # The bigger the replication backlog, the longer the time the slave can be 331 | # disconnected and later be able to perform a partial resynchronization. 332 | # 333 | # The backlog is only allocated once there is at least a slave connected. 334 | # 335 | # repl-backlog-size 1mb 336 | 337 | # After a master has no longer connected slaves for some time, the backlog 338 | # will be freed. The following option configures the amount of seconds that 339 | # need to elapse, starting from the time the last slave disconnected, for 340 | # the backlog buffer to be freed. 341 | # 342 | # A value of 0 means to never release the backlog. 343 | # 344 | # repl-backlog-ttl 3600 345 | 346 | # The slave priority is an integer number published by Redis in the INFO output. 347 | # It is used by Redis Sentinel in order to select a slave to promote into a 348 | # master if the master is no longer working correctly. 349 | # 350 | # A slave with a low priority number is considered better for promotion, so 351 | # for instance if there are three slaves with priority 10, 100, 25 Sentinel will 352 | # pick the one with priority 10, that is the lowest. 353 | # 354 | # However a special priority of 0 marks the slave as not able to perform the 355 | # role of master, so a slave with priority of 0 will never be selected by 356 | # Redis Sentinel for promotion. 357 | # 358 | # By default the priority is 100. 359 | slave-priority 100 360 | 361 | # It is possible for a master to stop accepting writes if there are less than 362 | # N slaves connected, having a lag less or equal than M seconds. 363 | # 364 | # The N slaves need to be in "online" state. 365 | # 366 | # The lag in seconds, that must be <= the specified value, is calculated from 367 | # the last ping received from the slave, that is usually sent every second. 368 | # 369 | # This option does not GUARANTEE that N replicas will accept the write, but 370 | # will limit the window of exposure for lost writes in case not enough slaves 371 | # are available, to the specified number of seconds. 372 | # 373 | # For example to require at least 3 slaves with a lag <= 10 seconds use: 374 | # 375 | # min-slaves-to-write 3 376 | # min-slaves-max-lag 10 377 | # 378 | # Setting one or the other to 0 disables the feature. 379 | # 380 | # By default min-slaves-to-write is set to 0 (feature disabled) and 381 | # min-slaves-max-lag is set to 10. 382 | 383 | ################################## SECURITY ################################### 384 | 385 | # Require clients to issue AUTH before processing any other 386 | # commands. This might be useful in environments in which you do not trust 387 | # others with access to the host running redis-server. 388 | # 389 | # This should stay commented out for backward compatibility and because most 390 | # people do not need auth (e.g. they run their own servers). 391 | # 392 | # Warning: since Redis is pretty fast an outside user can try up to 393 | # 150k passwords per second against a good box. This means that you should 394 | # use a very strong password otherwise it will be very easy to break. 395 | # 396 | # requirepass foobared 397 | 398 | # Command renaming. 399 | # 400 | # It is possible to change the name of dangerous commands in a shared 401 | # environment. For instance the CONFIG command may be renamed into something 402 | # hard to guess so that it will still be available for internal-use tools 403 | # but not available for general clients. 404 | # 405 | # Example: 406 | # 407 | # rename-command CONFIG b840fc02d524045429941cc15f59e41cb7be6c52 408 | # 409 | # It is also possible to completely kill a command by renaming it into 410 | # an empty string: 411 | # 412 | # rename-command CONFIG "" 413 | # 414 | # Please note that changing the name of commands that are logged into the 415 | # AOF file or transmitted to slaves may cause problems. 416 | 417 | ################################### LIMITS #################################### 418 | 419 | # Set the max number of connected clients at the same time. By default 420 | # this limit is set to 10000 clients, however if the Redis server is not 421 | # able to configure the process file limit to allow for the specified limit 422 | # the max number of allowed clients is set to the current file limit 423 | # minus 32 (as Redis reserves a few file descriptors for internal uses). 424 | # 425 | # Once the limit is reached Redis will close all the new connections sending 426 | # an error 'max number of clients reached'. 427 | # 428 | # maxclients 10000 429 | 430 | # Don't use more memory than the specified amount of bytes. 431 | # When the memory limit is reached Redis will try to remove keys 432 | # according to the eviction policy selected (see maxmemory-policy). 433 | # 434 | # If Redis can't remove keys according to the policy, or if the policy is 435 | # set to 'noeviction', Redis will start to reply with errors to commands 436 | # that would use more memory, like SET, LPUSH, and so on, and will continue 437 | # to reply to read-only commands like GET. 438 | # 439 | # This option is usually useful when using Redis as an LRU cache, or to set 440 | # a hard memory limit for an instance (using the 'noeviction' policy). 441 | # 442 | # WARNING: If you have slaves attached to an instance with maxmemory on, 443 | # the size of the output buffers needed to feed the slaves are subtracted 444 | # from the used memory count, so that network problems / resyncs will 445 | # not trigger a loop where keys are evicted, and in turn the output 446 | # buffer of slaves is full with DELs of keys evicted triggering the deletion 447 | # of more keys, and so forth until the database is completely emptied. 448 | # 449 | # In short... if you have slaves attached it is suggested that you set a lower 450 | # limit for maxmemory so that there is some free RAM on the system for slave 451 | # output buffers (but this is not needed if the policy is 'noeviction'). 452 | # 453 | # maxmemory 454 | 455 | # MAXMEMORY POLICY: how Redis will select what to remove when maxmemory 456 | # is reached. You can select among five behaviors: 457 | # 458 | # volatile-lru -> remove the key with an expire set using an LRU algorithm 459 | # allkeys-lru -> remove any key according to the LRU algorithm 460 | # volatile-random -> remove a random key with an expire set 461 | # allkeys-random -> remove a random key, any key 462 | # volatile-ttl -> remove the key with the nearest expire time (minor TTL) 463 | # noeviction -> don't expire at all, just return an error on write operations 464 | # 465 | # Note: with any of the above policies, Redis will return an error on write 466 | # operations, when there are no suitable keys for eviction. 467 | # 468 | # At the date of writing these commands are: set setnx setex append 469 | # incr decr rpush lpush rpushx lpushx linsert lset rpoplpush sadd 470 | # sinter sinterstore sunion sunionstore sdiff sdiffstore zadd zincrby 471 | # zunionstore zinterstore hset hsetnx hmset hincrby incrby decrby 472 | # getset mset msetnx exec sort 473 | # 474 | # The default is: 475 | # 476 | # maxmemory-policy noeviction 477 | 478 | # LRU and minimal TTL algorithms are not precise algorithms but approximated 479 | # algorithms (in order to save memory), so you can tune it for speed or 480 | # accuracy. For default Redis will check five keys and pick the one that was 481 | # used less recently, you can change the sample size using the following 482 | # configuration directive. 483 | # 484 | # The default of 5 produces good enough results. 10 Approximates very closely 485 | # true LRU but costs a bit more CPU. 3 is very fast but not very accurate. 486 | # 487 | # maxmemory-samples 5 488 | 489 | ############################## APPEND ONLY MODE ############################### 490 | 491 | # By default Redis asynchronously dumps the dataset on disk. This mode is 492 | # good enough in many applications, but an issue with the Redis process or 493 | # a power outage may result into a few minutes of writes lost (depending on 494 | # the configured save points). 495 | # 496 | # The Append Only File is an alternative persistence mode that provides 497 | # much better durability. For instance using the default data fsync policy 498 | # (see later in the config file) Redis can lose just one second of writes in a 499 | # dramatic event like a server power outage, or a single write if something 500 | # wrong with the Redis process itself happens, but the operating system is 501 | # still running correctly. 502 | # 503 | # AOF and RDB persistence can be enabled at the same time without problems. 504 | # If the AOF is enabled on startup Redis will load the AOF, that is the file 505 | # with the better durability guarantees. 506 | # 507 | # Please check http://redis.io/topics/persistence for more information. 508 | 509 | appendonly no 510 | 511 | # The name of the append only file (default: "appendonly.aof") 512 | 513 | appendfilename "appendonly.aof" 514 | 515 | # The fsync() call tells the Operating System to actually write data on disk 516 | # instead of waiting for more data in the output buffer. Some OS will really flush 517 | # data on disk, some other OS will just try to do it ASAP. 518 | # 519 | # Redis supports three different modes: 520 | # 521 | # no: don't fsync, just let the OS flush the data when it wants. Faster. 522 | # always: fsync after every write to the append only log. Slow, Safest. 523 | # everysec: fsync only one time every second. Compromise. 524 | # 525 | # The default is "everysec", as that's usually the right compromise between 526 | # speed and data safety. It's up to you to understand if you can relax this to 527 | # "no" that will let the operating system flush the output buffer when 528 | # it wants, for better performances (but if you can live with the idea of 529 | # some data loss consider the default persistence mode that's snapshotting), 530 | # or on the contrary, use "always" that's very slow but a bit safer than 531 | # everysec. 532 | # 533 | # More details please check the following article: 534 | # http://antirez.com/post/redis-persistence-demystified.html 535 | # 536 | # If unsure, use "everysec". 537 | 538 | # appendfsync always 539 | appendfsync everysec 540 | # appendfsync no 541 | 542 | # When the AOF fsync policy is set to always or everysec, and a background 543 | # saving process (a background save or AOF log background rewriting) is 544 | # performing a lot of I/O against the disk, in some Linux configurations 545 | # Redis may block too long on the fsync() call. Note that there is no fix for 546 | # this currently, as even performing fsync in a different thread will block 547 | # our synchronous write(2) call. 548 | # 549 | # In order to mitigate this problem it's possible to use the following option 550 | # that will prevent fsync() from being called in the main process while a 551 | # BGSAVE or BGREWRITEAOF is in progress. 552 | # 553 | # This means that while another child is saving, the durability of Redis is 554 | # the same as "appendfsync none". In practical terms, this means that it is 555 | # possible to lose up to 30 seconds of log in the worst scenario (with the 556 | # default Linux settings). 557 | # 558 | # If you have latency problems turn this to "yes". Otherwise leave it as 559 | # "no" that is the safest pick from the point of view of durability. 560 | 561 | no-appendfsync-on-rewrite no 562 | 563 | # Automatic rewrite of the append only file. 564 | # Redis is able to automatically rewrite the log file implicitly calling 565 | # BGREWRITEAOF when the AOF log size grows by the specified percentage. 566 | # 567 | # This is how it works: Redis remembers the size of the AOF file after the 568 | # latest rewrite (if no rewrite has happened since the restart, the size of 569 | # the AOF at startup is used). 570 | # 571 | # This base size is compared to the current size. If the current size is 572 | # bigger than the specified percentage, the rewrite is triggered. Also 573 | # you need to specify a minimal size for the AOF file to be rewritten, this 574 | # is useful to avoid rewriting the AOF file even if the percentage increase 575 | # is reached but it is still pretty small. 576 | # 577 | # Specify a percentage of zero in order to disable the automatic AOF 578 | # rewrite feature. 579 | 580 | auto-aof-rewrite-percentage 100 581 | auto-aof-rewrite-min-size 64mb 582 | 583 | # An AOF file may be found to be truncated at the end during the Redis 584 | # startup process, when the AOF data gets loaded back into memory. 585 | # This may happen when the system where Redis is running 586 | # crashes, especially when an ext4 filesystem is mounted without the 587 | # data=ordered option (however this can't happen when Redis itself 588 | # crashes or aborts but the operating system still works correctly). 589 | # 590 | # Redis can either exit with an error when this happens, or load as much 591 | # data as possible (the default now) and start if the AOF file is found 592 | # to be truncated at the end. The following option controls this behavior. 593 | # 594 | # If aof-load-truncated is set to yes, a truncated AOF file is loaded and 595 | # the Redis server starts emitting a log to inform the user of the event. 596 | # Otherwise if the option is set to no, the server aborts with an error 597 | # and refuses to start. When the option is set to no, the user requires 598 | # to fix the AOF file using the "redis-check-aof" utility before to restart 599 | # the server. 600 | # 601 | # Note that if the AOF file will be found to be corrupted in the middle 602 | # the server will still exit with an error. This option only applies when 603 | # Redis will try to read more data from the AOF file but not enough bytes 604 | # will be found. 605 | aof-load-truncated yes 606 | 607 | ################################ LUA SCRIPTING ############################### 608 | 609 | # Max execution time of a Lua script in milliseconds. 610 | # 611 | # If the maximum execution time is reached Redis will log that a script is 612 | # still in execution after the maximum allowed time and will start to 613 | # reply to queries with an error. 614 | # 615 | # When a long running script exceeds the maximum execution time only the 616 | # SCRIPT KILL and SHUTDOWN NOSAVE commands are available. The first can be 617 | # used to stop a script that did not yet called write commands. The second 618 | # is the only way to shut down the server in the case a write command was 619 | # already issued by the script but the user doesn't want to wait for the natural 620 | # termination of the script. 621 | # 622 | # Set it to 0 or a negative value for unlimited execution without warnings. 623 | lua-time-limit 5000 624 | 625 | ################################ REDIS CLUSTER ############################### 626 | # 627 | # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 628 | # WARNING EXPERIMENTAL: Redis Cluster is considered to be stable code, however 629 | # in order to mark it as "mature" we need to wait for a non trivial percentage 630 | # of users to deploy it in production. 631 | # ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 632 | # 633 | # Normal Redis instances can't be part of a Redis Cluster; only nodes that are 634 | # started as cluster nodes can. In order to start a Redis instance as a 635 | # cluster node enable the cluster support uncommenting the following: 636 | # 637 | # cluster-enabled yes 638 | 639 | # Every cluster node has a cluster configuration file. This file is not 640 | # intended to be edited by hand. It is created and updated by Redis nodes. 641 | # Every Redis Cluster node requires a different cluster configuration file. 642 | # Make sure that instances running in the same system do not have 643 | # overlapping cluster configuration file names. 644 | # 645 | # cluster-config-file nodes-6379.conf 646 | 647 | # Cluster node timeout is the amount of milliseconds a node must be unreachable 648 | # for it to be considered in failure state. 649 | # Most other internal time limits are multiple of the node timeout. 650 | # 651 | # cluster-node-timeout 15000 652 | 653 | # A slave of a failing master will avoid to start a failover if its data 654 | # looks too old. 655 | # 656 | # There is no simple way for a slave to actually have a exact measure of 657 | # its "data age", so the following two checks are performed: 658 | # 659 | # 1) If there are multiple slaves able to failover, they exchange messages 660 | # in order to try to give an advantage to the slave with the best 661 | # replication offset (more data from the master processed). 662 | # Slaves will try to get their rank by offset, and apply to the start 663 | # of the failover a delay proportional to their rank. 664 | # 665 | # 2) Every single slave computes the time of the last interaction with 666 | # its master. This can be the last ping or command received (if the master 667 | # is still in the "connected" state), or the time that elapsed since the 668 | # disconnection with the master (if the replication link is currently down). 669 | # If the last interaction is too old, the slave will not try to failover 670 | # at all. 671 | # 672 | # The point "2" can be tuned by user. Specifically a slave will not perform 673 | # the failover if, since the last interaction with the master, the time 674 | # elapsed is greater than: 675 | # 676 | # (node-timeout * slave-validity-factor) + repl-ping-slave-period 677 | # 678 | # So for example if node-timeout is 30 seconds, and the slave-validity-factor 679 | # is 10, and assuming a default repl-ping-slave-period of 10 seconds, the 680 | # slave will not try to failover if it was not able to talk with the master 681 | # for longer than 310 seconds. 682 | # 683 | # A large slave-validity-factor may allow slaves with too old data to failover 684 | # a master, while a too small value may prevent the cluster from being able to 685 | # elect a slave at all. 686 | # 687 | # For maximum availability, it is possible to set the slave-validity-factor 688 | # to a value of 0, which means, that slaves will always try to failover the 689 | # master regardless of the last time they interacted with the master. 690 | # (However they'll always try to apply a delay proportional to their 691 | # offset rank). 692 | # 693 | # Zero is the only value able to guarantee that when all the partitions heal 694 | # the cluster will always be able to continue. 695 | # 696 | # cluster-slave-validity-factor 10 697 | 698 | # Cluster slaves are able to migrate to orphaned masters, that are masters 699 | # that are left without working slaves. This improves the cluster ability 700 | # to resist to failures as otherwise an orphaned master can't be failed over 701 | # in case of failure if it has no working slaves. 702 | # 703 | # Slaves migrate to orphaned masters only if there are still at least a 704 | # given number of other working slaves for their old master. This number 705 | # is the "migration barrier". A migration barrier of 1 means that a slave 706 | # will migrate only if there is at least 1 other working slave for its master 707 | # and so forth. It usually reflects the number of slaves you want for every 708 | # master in your cluster. 709 | # 710 | # Default is 1 (slaves migrate only if their masters remain with at least 711 | # one slave). To disable migration just set it to a very large value. 712 | # A value of 0 can be set but is useful only for debugging and dangerous 713 | # in production. 714 | # 715 | # cluster-migration-barrier 1 716 | 717 | # By default Redis Cluster nodes stop accepting queries if they detect there 718 | # is at least an hash slot uncovered (no available node is serving it). 719 | # This way if the cluster is partially down (for example a range of hash slots 720 | # are no longer covered) all the cluster becomes, eventually, unavailable. 721 | # It automatically returns available as soon as all the slots are covered again. 722 | # 723 | # However sometimes you want the subset of the cluster which is working, 724 | # to continue to accept queries for the part of the key space that is still 725 | # covered. In order to do so, just set the cluster-require-full-coverage 726 | # option to no. 727 | # 728 | # cluster-require-full-coverage yes 729 | 730 | # In order to setup your cluster make sure to read the documentation 731 | # available at http://redis.io web site. 732 | 733 | ################################## SLOW LOG ################################### 734 | 735 | # The Redis Slow Log is a system to log queries that exceeded a specified 736 | # execution time. The execution time does not include the I/O operations 737 | # like talking with the client, sending the reply and so forth, 738 | # but just the time needed to actually execute the command (this is the only 739 | # stage of command execution where the thread is blocked and can not serve 740 | # other requests in the meantime). 741 | # 742 | # You can configure the slow log with two parameters: one tells Redis 743 | # what is the execution time, in microseconds, to exceed in order for the 744 | # command to get logged, and the other parameter is the length of the 745 | # slow log. When a new command is logged the oldest one is removed from the 746 | # queue of logged commands. 747 | 748 | # The following time is expressed in microseconds, so 1000000 is equivalent 749 | # to one second. Note that a negative number disables the slow log, while 750 | # a value of zero forces the logging of every command. 751 | slowlog-log-slower-than 10000 752 | 753 | # There is no limit to this length. Just be aware that it will consume memory. 754 | # You can reclaim memory used by the slow log with SLOWLOG RESET. 755 | slowlog-max-len 128 756 | 757 | ################################ LATENCY MONITOR ############################## 758 | 759 | # The Redis latency monitoring subsystem samples different operations 760 | # at runtime in order to collect data related to possible sources of 761 | # latency of a Redis instance. 762 | # 763 | # Via the LATENCY command this information is available to the user that can 764 | # print graphs and obtain reports. 765 | # 766 | # The system only logs operations that were performed in a time equal or 767 | # greater than the amount of milliseconds specified via the 768 | # latency-monitor-threshold configuration directive. When its value is set 769 | # to zero, the latency monitor is turned off. 770 | # 771 | # By default latency monitoring is disabled since it is mostly not needed 772 | # if you don't have latency issues, and collecting data has a performance 773 | # impact, that while very small, can be measured under big load. Latency 774 | # monitoring can easily be enabled at runtime using the command 775 | # "CONFIG SET latency-monitor-threshold " if needed. 776 | latency-monitor-threshold 0 777 | 778 | ############################# EVENT NOTIFICATION ############################## 779 | 780 | # Redis can notify Pub/Sub clients about events happening in the key space. 781 | # This feature is documented at http://redis.io/topics/notifications 782 | # 783 | # For instance if keyspace events notification is enabled, and a client 784 | # performs a DEL operation on key "foo" stored in the Database 0, two 785 | # messages will be published via Pub/Sub: 786 | # 787 | # PUBLISH __keyspace@0__:foo del 788 | # PUBLISH __keyevent@0__:del foo 789 | # 790 | # It is possible to select the events that Redis will notify among a set 791 | # of classes. Every class is identified by a single character: 792 | # 793 | # K Keyspace events, published with __keyspace@__ prefix. 794 | # E Keyevent events, published with __keyevent@__ prefix. 795 | # g Generic commands (non-type specific) like DEL, EXPIRE, RENAME, ... 796 | # $ String commands 797 | # l List commands 798 | # s Set commands 799 | # h Hash commands 800 | # z Sorted set commands 801 | # x Expired events (events generated every time a key expires) 802 | # e Evicted events (events generated when a key is evicted for maxmemory) 803 | # A Alias for g$lshzxe, so that the "AKE" string means all the events. 804 | # 805 | # The "notify-keyspace-events" takes as argument a string that is composed 806 | # of zero or multiple characters. The empty string means that notifications 807 | # are disabled. 808 | # 809 | # Example: to enable list and generic events, from the point of view of the 810 | # event name, use: 811 | # 812 | # notify-keyspace-events Elg 813 | # 814 | # Example 2: to get the stream of the expired keys subscribing to channel 815 | # name __keyevent@0__:expired use: 816 | # 817 | # notify-keyspace-events Ex 818 | # 819 | # By default all notifications are disabled because most users don't need 820 | # this feature and the feature has some overhead. Note that if you don't 821 | # specify at least one of K or E, no events will be delivered. 822 | notify-keyspace-events "AKE" 823 | 824 | ############################### ADVANCED CONFIG ############################### 825 | 826 | # Hashes are encoded using a memory efficient data structure when they have a 827 | # small number of entries, and the biggest entry does not exceed a given 828 | # threshold. These thresholds can be configured using the following directives. 829 | hash-max-ziplist-entries 512 830 | hash-max-ziplist-value 64 831 | 832 | # Similarly to hashes, small lists are also encoded in a special way in order 833 | # to save a lot of space. The special representation is only used when 834 | # you are under the following limits: 835 | list-max-ziplist-entries 512 836 | list-max-ziplist-value 64 837 | 838 | # Sets have a special encoding in just one case: when a set is composed 839 | # of just strings that happen to be integers in radix 10 in the range 840 | # of 64 bit signed integers. 841 | # The following configuration setting sets the limit in the size of the 842 | # set in order to use this special memory saving encoding. 843 | set-max-intset-entries 512 844 | 845 | # Similarly to hashes and lists, sorted sets are also specially encoded in 846 | # order to save a lot of space. This encoding is only used when the length and 847 | # elements of a sorted set are below the following limits: 848 | zset-max-ziplist-entries 128 849 | zset-max-ziplist-value 64 850 | 851 | # HyperLogLog sparse representation bytes limit. The limit includes the 852 | # 16 bytes header. When an HyperLogLog using the sparse representation crosses 853 | # this limit, it is converted into the dense representation. 854 | # 855 | # A value greater than 16000 is totally useless, since at that point the 856 | # dense representation is more memory efficient. 857 | # 858 | # The suggested value is ~ 3000 in order to have the benefits of 859 | # the space efficient encoding without slowing down too much PFADD, 860 | # which is O(N) with the sparse encoding. The value can be raised to 861 | # ~ 10000 when CPU is not a concern, but space is, and the data set is 862 | # composed of many HyperLogLogs with cardinality in the 0 - 15000 range. 863 | hll-sparse-max-bytes 3000 864 | 865 | # Active rehashing uses 1 millisecond every 100 milliseconds of CPU time in 866 | # order to help rehashing the main Redis hash table (the one mapping top-level 867 | # keys to values). The hash table implementation Redis uses (see dict.c) 868 | # performs a lazy rehashing: the more operation you run into a hash table 869 | # that is rehashing, the more rehashing "steps" are performed, so if the 870 | # server is idle the rehashing is never complete and some more memory is used 871 | # by the hash table. 872 | # 873 | # The default is to use this millisecond 10 times every second in order to 874 | # actively rehash the main dictionaries, freeing memory when possible. 875 | # 876 | # If unsure: 877 | # use "activerehashing no" if you have hard latency requirements and it is 878 | # not a good thing in your environment that Redis can reply from time to time 879 | # to queries with 2 milliseconds delay. 880 | # 881 | # use "activerehashing yes" if you don't have such hard requirements but 882 | # want to free memory asap when possible. 883 | activerehashing yes 884 | 885 | # The client output buffer limits can be used to force disconnection of clients 886 | # that are not reading data from the server fast enough for some reason (a 887 | # common reason is that a Pub/Sub client can't consume messages as fast as the 888 | # publisher can produce them). 889 | # 890 | # The limit can be set differently for the three different classes of clients: 891 | # 892 | # normal -> normal clients including MONITOR clients 893 | # slave -> slave clients 894 | # pubsub -> clients subscribed to at least one pubsub channel or pattern 895 | # 896 | # The syntax of every client-output-buffer-limit directive is the following: 897 | # 898 | # client-output-buffer-limit 899 | # 900 | # A client is immediately disconnected once the hard limit is reached, or if 901 | # the soft limit is reached and remains reached for the specified number of 902 | # seconds (continuously). 903 | # So for instance if the hard limit is 32 megabytes and the soft limit is 904 | # 16 megabytes / 10 seconds, the client will get disconnected immediately 905 | # if the size of the output buffers reach 32 megabytes, but will also get 906 | # disconnected if the client reaches 16 megabytes and continuously overcomes 907 | # the limit for 10 seconds. 908 | # 909 | # By default normal clients are not limited because they don't receive data 910 | # without asking (in a push way), but just after a request, so only 911 | # asynchronous clients may create a scenario where data is requested faster 912 | # than it can read. 913 | # 914 | # Instead there is a default limit for pubsub and slave clients, since 915 | # subscribers and slaves receive data in a push fashion. 916 | # 917 | # Both the hard or the soft limit can be disabled by setting them to zero. 918 | client-output-buffer-limit normal 0 0 0 919 | client-output-buffer-limit slave 256mb 64mb 60 920 | client-output-buffer-limit pubsub 32mb 8mb 60 921 | 922 | # Redis calls an internal function to perform many background tasks, like 923 | # closing connections of clients in timeout, purging expired keys that are 924 | # never requested, and so forth. 925 | # 926 | # Not all tasks are performed with the same frequency, but Redis checks for 927 | # tasks to perform according to the specified "hz" value. 928 | # 929 | # By default "hz" is set to 10. Raising the value will use more CPU when 930 | # Redis is idle, but at the same time will make Redis more responsive when 931 | # there are many keys expiring at the same time, and timeouts may be 932 | # handled with more precision. 933 | # 934 | # The range is between 1 and 500, however a value over 100 is usually not 935 | # a good idea. Most users should use the default of 10 and raise this up to 936 | # 100 only in environments where very low latency is required. 937 | hz 10 938 | 939 | # When a child rewrites the AOF file, if the following option is enabled 940 | # the file will be fsync-ed every 32 MB of data generated. This is useful 941 | # in order to commit the file to the disk more incrementally and avoid 942 | # big latency spikes. 943 | aof-rewrite-incremental-fsync yes 944 | -------------------------------------------------------------------------------- /run.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | ''' 3 | File: run.py 4 | Author: Gabriel Ryan 5 | Email: gryan@gdssecurity.com 6 | Source: http://github.com/s0lst1c3/sentrygun_server 7 | 8 | Description: 9 | 10 | Driver script for sentrygun-server. Performs the following upon execution: 11 | 12 | 1. Parses command line argument to set configuration values 13 | 2. Initializes, configures, and starts redis daemon. 14 | 3. Spawns a subprocess to monitor redis keyspace events 15 | 4. Spawns Flask-SocketIO instance defined in sentrygund module 16 | 17 | Usage: 18 | 19 | python run.py 20 | 21 | Command line arguments: 22 | 23 | --port - specifies the port on which sentrygun-server should listen (defaults to 80) 24 | 25 | --host - specifies the address at which sentrygun-server should listen (defaults to 0.0.0.0) 26 | 27 | --debug - Run in debug mode (not recommended for production environments) 28 | 29 | --expire - the number of seconds that alerts should remain active before being 30 | automatically dismissed 31 | 32 | ''' 33 | 34 | 35 | import time 36 | import json 37 | import subprocess 38 | import sys 39 | 40 | from argparse import ArgumentParser 41 | from sentrygund import sentrygund, socketio, RedisMon, utils 42 | from multiprocessing import Process 43 | 44 | def display_banner(): 45 | 46 | print ''' 47 | __ 48 | ______ ____ _____/ |________ ___.__. ____ __ __ ____ 49 | / ___// __ \\ / \\ __\\_ __ < | |/ ___\\| | \\/ \\ 50 | \\___ \\\\ ___/| | \ | | | \\/\\___ / /_/ > | / | \\ 51 | /____ >\\___ >___| /__| |__| / ____\\___ /|____/|___| / 52 | \\/ \\/ \\/ \\/ /_____/ \\/ 53 | 54 | 55 | version 1.0.0 56 | Gabriel Ryan 57 | Gotham Digital Science 58 | ''' 59 | 60 | print '[*] Starting on %s:%d . . .' % (sentrygund.config.host, sentrygund.config.port) 61 | print '[*] Debug mode is', 'on' if sentrygund.config.debug else 'off' 62 | print '[*] Alerts expiring after %d seconds' % sentrygund.config['EXPIRE'] 63 | 64 | def set_configs(): 65 | 66 | parser = ArgumentParser() 67 | 68 | parser.add_argument('--port', 69 | required=False, 70 | type=int, 71 | default=80, 72 | help='Specifies the port on which sentrygun-server should listen (defaults to 80)') 73 | 74 | parser.add_argument('--host', 75 | required=False, 76 | type=str, 77 | default='0.0.0.0', 78 | help='Specifies the address at which sentrygun-server should listen (defaults to 0.0.0.0)') 79 | 80 | parser.add_argument('--debug', 81 | action='store_true', 82 | default=False, 83 | help='Run in debug mode (not recommended for production environments)') 84 | 85 | parser.add_argument('--expire', 86 | dest='expire', 87 | required=False, 88 | type=int, 89 | default=0, 90 | help=''.join(['Sets the number of seconds that alerts ', 91 | 'should remain active before they are ', 92 | 'automatically dismissed. To disable alert ', 93 | 'expiration, set this to 0 (default).'])) 94 | 95 | parser.add_argument('--tunnels', 96 | dest='tunnels', 97 | required=False, 98 | type=str, 99 | nargs='+', 100 | metavar='dest', 101 | help=''.join(['Create an ssh tunnel from localhost:PORT on ', 102 | 'sentrygun-server to localhost:PORT on a list ', 103 | 'of of sentrygun clients, where PORT is the port ', 104 | 'at which sentrygun-server listens on. When this ', 105 | 'flag is used, sentrygun-server will always listen ', 106 | 'on localhost regardless of whether the --host is ', 107 | 'used. Use this option when running sentrygun on a ', 108 | 'hostile network. Sentrygun clients should be ', 109 | 'specified with the format user@host:port.'])) 110 | 111 | args = parser.parse_args() 112 | 113 | sentrygund.config['TUNNELS'] = args.tunnels 114 | sentrygund.config.port = args.port 115 | sentrygund.config.host = '127.0.0.1' if args.tunnels is None else args.host 116 | sentrygund.config.debug = args.debug 117 | sentrygund.config['EXPIRE'] = args.expire 118 | sentrygund.config['USE_REDIS'] = args.expire > 0 119 | 120 | def main(): 121 | 122 | set_configs() 123 | 124 | if sentrygund.config['TUNNELS'] is not None: 125 | utils.create_reverse_tunnels() 126 | 127 | display_banner() 128 | 129 | if sentrygund.config['USE_REDIS']: 130 | print '[*] Starting redis-server daemon...' 131 | utils.os_system('redis-server ./redis.conf') 132 | 133 | time.sleep(2) 134 | 135 | print '[*] Starting SentryGun server...' 136 | 137 | try: 138 | 139 | print '[*] SentryGun server is running ...' 140 | 141 | redis_mon = RedisMon(sentrygund.config.host, 142 | sentrygund.config.port, 143 | sentrygund.config.debug) 144 | 145 | if sentrygund.config['USE_REDIS']: 146 | redis_mon.start() 147 | 148 | socketio.run(sentrygund, 149 | host=sentrygund.config.host, 150 | port=sentrygund.config.port, 151 | debug=sentrygund.config.debug) 152 | 153 | except KeyboardInterrupt: 154 | 155 | if sentrygund.config['TUNNELS'] is not None: 156 | utils.destroy_reverse_tunnels() 157 | 158 | if sentrygund.config['USE_REDIS']: 159 | redis_mon.stop() 160 | 161 | print '[*] Gracefully shutting down redis-server' 162 | 163 | # yep, "gracefully" 164 | utils.os_system('for i in `pgrep redis-server`; do kill $i; done') 165 | utils.os_system('rm -f dump.rdb') 166 | 167 | print '[*] Goodbye!' 168 | 169 | if __name__ == '__main__': 170 | main() 171 | -------------------------------------------------------------------------------- /scripts/close_botnet.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | rhost=$1 3 | port=$2 4 | 5 | MYCOMMAND=`base64 -w0 ./scripts/terminate.sh` 6 | echo $MYCOMMAND 7 | ssh -p "$port" "$rhost" "echo $MYCOMMAND | base64 -d | sudo bash" 8 | -------------------------------------------------------------------------------- /scripts/kill_autossh.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | for i in `ps aux | grep 'autossh' | grep -v 'grep' | awk '{ print $2 }'`; do 4 | 5 | echo "[!] Killing autossh connection with PID: $i"; 6 | 7 | kill $i 8 | 9 | done 10 | -------------------------------------------------------------------------------- /scripts/open_botnet.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | identity_file=$1 4 | #identity_file='/root/.ssh/id_rsa' 5 | port=$2 6 | rhost=$3 7 | lport=$4 8 | autossh_out=$5 9 | 10 | autossh -M $autossh_out -o "PubKeyAuthentication=yes" -o "PasswordAuthentication=no" -i $identity_file -p $port -N -R "$lport:localhost:$lport" "$rhost" -f 11 | 12 | #lport='4444' 13 | 14 | #while read line 15 | #do 16 | # 17 | # rhost="$(echo $line | awk '{ print $1 }')" 18 | # port="$(echo $line | awk '{ print $2 }')" 19 | # autossh -M $autossh_out -o "PubKeyAuthentication=yes" -o "PasswordAuthentication=no" -i $identity_file -p $port -N -R "$lport:localhost:$lport" "$rhost" -f 20 | # 21 | # echo "[*] Opening reverse shell from $line" 22 | # 23 | # ((autossh_out+=2)) 24 | #done < 'clients.txt' 25 | -------------------------------------------------------------------------------- /scripts/terminate.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | port="$1" 3 | rhost="$2" 4 | #echo $port 5 | #echo $rhost 6 | for i in `lsof -i :4444 | grep sshd | awk '{ print $2 }' `; do kill $i; done 7 | -------------------------------------------------------------------------------- /sentrygund/__init__.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | ''' 3 | Module: sentrygund 4 | Author: Gabriel Ryan 5 | Email: gryan@gdssecurity.com 6 | Source: http://github.com/s0lst1c3/sentrygun_server 7 | 8 | Description: 9 | 10 | This module contains the majority of sentrygun-servers MVC code. 11 | 12 | ''' 13 | 14 | import os 15 | 16 | from flask import Flask 17 | from flask_socketio import SocketIO 18 | 19 | sentrygund = Flask(__name__) 20 | 21 | basedir = os.path.abspath(os.path.dirname(__file__)) 22 | #sentrygund.config.from_pyfile('./config.py') 23 | sentrygund.config.from_object('config') 24 | 25 | socketio = SocketIO(sentrygund) 26 | 27 | from sentrygund import models, views 28 | from redis_monitor import RedisMon 29 | -------------------------------------------------------------------------------- /sentrygund/models.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | ''' 3 | File: models.py 4 | Module: sentrygund 5 | Author: Gabriel Ryan 6 | Email: gryan@gdssecurity.com 7 | Source: http://github.com/s0lst1c3/sentrygun-server 8 | 9 | Description: 10 | 11 | This file represents the model in sentrygun-server's MVC architecture. All 12 | calls to databases and storage happen here. 13 | 14 | ''' 15 | 16 | import json 17 | import redis 18 | 19 | from sentrygund import sentrygund 20 | 21 | current_alerts = {} 22 | 23 | def store_alert(alert): 24 | 25 | global current_alerts 26 | 27 | if sentrygund.config['USE_REDIS']: 28 | 29 | r = redis.Redis() 30 | r.set('%s:%s' % (alert['id'], alert['location']), alert['location']) 31 | r.expire('%s:%s' % (alert['id'], alert['location']), sentrygund.config['EXPIRE']) 32 | 33 | _id = alert['id'] 34 | 35 | if _id in current_alerts: 36 | 37 | current_alerts[_id]['timestamp'] = alert['timestamp'] 38 | current_alerts[_id]['locations'][alert['location']] = alert['tx'] 39 | 40 | else: 41 | 42 | current_alerts[_id] = alert 43 | current_alerts[_id]['locations'] = { alert['location'] : alert['tx'] } 44 | 45 | return current_alerts[_id] 46 | 47 | def retrieve_alerts(): 48 | 49 | all_alerts = [] 50 | 51 | return current_alerts.values() 52 | 53 | def retrieve_alert(a): 54 | 55 | if sentrygund.config['DEBUG']: 56 | 57 | print '[debug] models.py - current_alerts is:', 58 | print json.dumps(current_alerts, indent=4, sort_keys=True) 59 | 60 | return current_alerts[a['id']] 61 | 62 | def remove_alerts(alerts): 63 | 64 | global current_alerts 65 | 66 | for a in alerts: 67 | 68 | if a['id'] in current_alerts: 69 | 70 | if sentrygund.config['DEBUG']: 71 | print '[debug] models.py - removing from', json.dumps(current_alerts, indent=4, sort_keys=True) 72 | 73 | del current_alerts[a['id']] 74 | -------------------------------------------------------------------------------- /sentrygund/redis_monitor.py: -------------------------------------------------------------------------------- 1 | from multiprocessing import Process 2 | 3 | def worker(rhost, rport, debug): 4 | 5 | # this is awful but this needs to be ready in three weeks 6 | import redis 7 | import requests 8 | 9 | if debug: 10 | print '[debug][redis_mon] starting redis monitor' 11 | 12 | r = redis.StrictRedis() 13 | pubsub = r.pubsub() 14 | pubsub.psubscribe('*') 15 | for msg in pubsub.listen(): 16 | 17 | if debug: 18 | print '[debug][redis_mon]', msg 19 | 20 | if 'expired' in msg['channel']: 21 | 22 | msg = msg['data'].split(':') 23 | alert = [{ 'id' : msg[0], 'location' : msg[1] }] 24 | 25 | response = requests.post('http://%s:%d/alert/dismiss' % (rhost, rport), json=alert) 26 | 27 | if debug: 28 | print '[debug][redis_mon] sent to self:', response 29 | 30 | class RedisMon(object): 31 | 32 | def __init__(self, lhost=None, lport=None, debug=False): 33 | 34 | self.lhost = lhost 35 | self.lport = lport 36 | self.debug = debug 37 | self.pid = None 38 | 39 | def start(self): 40 | 41 | args = (self.lhost, self.lport, self.debug,) 42 | self.pid = Process(target=worker, args=args) 43 | 44 | self.pid.daemon = True 45 | self.pid.start() 46 | 47 | def stop(self): 48 | 49 | self.terminate() 50 | -------------------------------------------------------------------------------- /sentrygund/static/css/images/ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/s0lst1c3/sentrygun-server/cbbfcafa0356d80c327490ff1dae528219a3efa8/sentrygund/static/css/images/ajax-loader.gif -------------------------------------------------------------------------------- /sentrygund/static/css/jquery-ui.css: -------------------------------------------------------------------------------- 1 | /*! jQuery UI - v1.10.4 - 2014-01-17 2 | * http://jqueryui.com 3 | * Includes: jquery.ui.core.css, jquery.ui.accordion.css, jquery.ui.autocomplete.css, jquery.ui.button.css, jquery.ui.datepicker.css, jquery.ui.dialog.css, jquery.ui.menu.css, jquery.ui.progressbar.css, jquery.ui.resizable.css, jquery.ui.selectable.css, jquery.ui.slider.css, jquery.ui.spinner.css, jquery.ui.tabs.css, jquery.ui.tooltip.css, jquery.ui.theme.css 4 | * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana%2CArial%2Csans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=highlight_soft&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=flat&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=glass&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=glass&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=glass&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=glass&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=glass&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=flat&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=flat&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px 5 | * Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */ 6 | 7 | /* Layout helpers 8 | ----------------------------------*/ 9 | .ui-helper-hidden { 10 | display: none; 11 | } 12 | .ui-helper-hidden-accessible { 13 | border: 0; 14 | clip: rect(0 0 0 0); 15 | height: 1px; 16 | margin: -1px; 17 | overflow: hidden; 18 | padding: 0; 19 | position: absolute; 20 | width: 1px; 21 | } 22 | .ui-helper-reset { 23 | margin: 0; 24 | padding: 0; 25 | border: 0; 26 | outline: 0; 27 | line-height: 1.3; 28 | text-decoration: none; 29 | font-size: 100%; 30 | list-style: none; 31 | } 32 | .ui-helper-clearfix:before, 33 | .ui-helper-clearfix:after { 34 | content: ""; 35 | display: table; 36 | border-collapse: collapse; 37 | } 38 | .ui-helper-clearfix:after { 39 | clear: both; 40 | } 41 | .ui-helper-clearfix { 42 | min-height: 0; /* support: IE7 */ 43 | } 44 | .ui-helper-zfix { 45 | width: 100%; 46 | height: 100%; 47 | top: 0; 48 | left: 0; 49 | position: absolute; 50 | opacity: 0; 51 | filter:Alpha(Opacity=0); 52 | } 53 | 54 | .ui-front { 55 | z-index: 100; 56 | } 57 | 58 | 59 | /* Interaction Cues 60 | ----------------------------------*/ 61 | .ui-state-disabled { 62 | cursor: default !important; 63 | } 64 | 65 | 66 | /* Icons 67 | ----------------------------------*/ 68 | 69 | /* states and images */ 70 | .ui-icon { 71 | display: block; 72 | text-indent: -99999px; 73 | overflow: hidden; 74 | background-repeat: no-repeat; 75 | } 76 | 77 | 78 | /* Misc visuals 79 | ----------------------------------*/ 80 | 81 | /* Overlays */ 82 | .ui-widget-overlay { 83 | position: fixed; 84 | top: 0; 85 | left: 0; 86 | width: 100%; 87 | height: 100%; 88 | } 89 | .ui-accordion .ui-accordion-header { 90 | display: block; 91 | cursor: pointer; 92 | position: relative; 93 | margin-top: 2px; 94 | padding: .5em .5em .5em .7em; 95 | min-height: 0; /* support: IE7 */ 96 | } 97 | .ui-accordion .ui-accordion-icons { 98 | padding-left: 2.2em; 99 | } 100 | .ui-accordion .ui-accordion-noicons { 101 | padding-left: .7em; 102 | } 103 | .ui-accordion .ui-accordion-icons .ui-accordion-icons { 104 | padding-left: 2.2em; 105 | } 106 | .ui-accordion .ui-accordion-header .ui-accordion-header-icon { 107 | position: absolute; 108 | left: .5em; 109 | top: 50%; 110 | margin-top: -8px; 111 | } 112 | .ui-accordion .ui-accordion-content { 113 | padding: 1em 2.2em; 114 | border-top: 0; 115 | overflow: auto; 116 | } 117 | .ui-autocomplete { 118 | position: absolute; 119 | top: 0; 120 | left: 0; 121 | cursor: default; 122 | } 123 | .ui-button { 124 | display: inline-block; 125 | position: relative; 126 | padding: 0; 127 | line-height: normal; 128 | margin-right: .1em; 129 | cursor: pointer; 130 | vertical-align: middle; 131 | text-align: center; 132 | overflow: visible; /* removes extra width in IE */ 133 | } 134 | .ui-button, 135 | .ui-button:link, 136 | .ui-button:visited, 137 | .ui-button:hover, 138 | .ui-button:active { 139 | text-decoration: none; 140 | } 141 | /* to make room for the icon, a width needs to be set here */ 142 | .ui-button-icon-only { 143 | width: 2.2em; 144 | } 145 | /* button elements seem to need a little more width */ 146 | button.ui-button-icon-only { 147 | width: 2.4em; 148 | } 149 | .ui-button-icons-only { 150 | width: 3.4em; 151 | } 152 | button.ui-button-icons-only { 153 | width: 3.7em; 154 | } 155 | 156 | /* button text element */ 157 | .ui-button .ui-button-text { 158 | display: block; 159 | line-height: normal; 160 | } 161 | .ui-button-text-only .ui-button-text { 162 | padding: .4em 1em; 163 | } 164 | .ui-button-icon-only .ui-button-text, 165 | .ui-button-icons-only .ui-button-text { 166 | padding: .4em; 167 | text-indent: -9999999px; 168 | } 169 | .ui-button-text-icon-primary .ui-button-text, 170 | .ui-button-text-icons .ui-button-text { 171 | padding: .4em 1em .4em 2.1em; 172 | } 173 | .ui-button-text-icon-secondary .ui-button-text, 174 | .ui-button-text-icons .ui-button-text { 175 | padding: .4em 2.1em .4em 1em; 176 | } 177 | .ui-button-text-icons .ui-button-text { 178 | padding-left: 2.1em; 179 | padding-right: 2.1em; 180 | } 181 | /* no icon support for input elements, provide padding by default */ 182 | input.ui-button { 183 | padding: .4em 1em; 184 | } 185 | 186 | /* button icon element(s) */ 187 | .ui-button-icon-only .ui-icon, 188 | .ui-button-text-icon-primary .ui-icon, 189 | .ui-button-text-icon-secondary .ui-icon, 190 | .ui-button-text-icons .ui-icon, 191 | .ui-button-icons-only .ui-icon { 192 | position: absolute; 193 | top: 50%; 194 | margin-top: -8px; 195 | } 196 | .ui-button-icon-only .ui-icon { 197 | left: 50%; 198 | margin-left: -8px; 199 | } 200 | .ui-button-text-icon-primary .ui-button-icon-primary, 201 | .ui-button-text-icons .ui-button-icon-primary, 202 | .ui-button-icons-only .ui-button-icon-primary { 203 | left: .5em; 204 | } 205 | .ui-button-text-icon-secondary .ui-button-icon-secondary, 206 | .ui-button-text-icons .ui-button-icon-secondary, 207 | .ui-button-icons-only .ui-button-icon-secondary { 208 | right: .5em; 209 | } 210 | 211 | /* button sets */ 212 | .ui-buttonset { 213 | margin-right: 7px; 214 | } 215 | .ui-buttonset .ui-button { 216 | margin-left: 0; 217 | margin-right: -.3em; 218 | } 219 | 220 | /* workarounds */ 221 | /* reset extra padding in Firefox, see h5bp.com/l */ 222 | input.ui-button::-moz-focus-inner, 223 | button.ui-button::-moz-focus-inner { 224 | border: 0; 225 | padding: 0; 226 | } 227 | .ui-datepicker { 228 | width: 17em; 229 | padding: .2em .2em 0; 230 | display: none; 231 | } 232 | .ui-datepicker .ui-datepicker-header { 233 | position: relative; 234 | padding: .2em 0; 235 | } 236 | .ui-datepicker .ui-datepicker-prev, 237 | .ui-datepicker .ui-datepicker-next { 238 | position: absolute; 239 | top: 2px; 240 | width: 1.8em; 241 | height: 1.8em; 242 | } 243 | .ui-datepicker .ui-datepicker-prev-hover, 244 | .ui-datepicker .ui-datepicker-next-hover { 245 | top: 1px; 246 | } 247 | .ui-datepicker .ui-datepicker-prev { 248 | left: 2px; 249 | } 250 | .ui-datepicker .ui-datepicker-next { 251 | right: 2px; 252 | } 253 | .ui-datepicker .ui-datepicker-prev-hover { 254 | left: 1px; 255 | } 256 | .ui-datepicker .ui-datepicker-next-hover { 257 | right: 1px; 258 | } 259 | .ui-datepicker .ui-datepicker-prev span, 260 | .ui-datepicker .ui-datepicker-next span { 261 | display: block; 262 | position: absolute; 263 | left: 50%; 264 | margin-left: -8px; 265 | top: 50%; 266 | margin-top: -8px; 267 | } 268 | .ui-datepicker .ui-datepicker-title { 269 | margin: 0 2.3em; 270 | line-height: 1.8em; 271 | text-align: center; 272 | } 273 | .ui-datepicker .ui-datepicker-title select { 274 | font-size: 1em; 275 | margin: 1px 0; 276 | } 277 | .ui-datepicker select.ui-datepicker-month, 278 | .ui-datepicker select.ui-datepicker-year { 279 | width: 49%; 280 | } 281 | .ui-datepicker table { 282 | width: 100%; 283 | font-size: .9em; 284 | border-collapse: collapse; 285 | margin: 0 0 .4em; 286 | } 287 | .ui-datepicker th { 288 | padding: .7em .3em; 289 | text-align: center; 290 | font-weight: bold; 291 | border: 0; 292 | } 293 | .ui-datepicker td { 294 | border: 0; 295 | padding: 1px; 296 | } 297 | .ui-datepicker td span, 298 | .ui-datepicker td a { 299 | display: block; 300 | padding: .2em; 301 | text-align: right; 302 | text-decoration: none; 303 | } 304 | .ui-datepicker .ui-datepicker-buttonpane { 305 | background-image: none; 306 | margin: .7em 0 0 0; 307 | padding: 0 .2em; 308 | border-left: 0; 309 | border-right: 0; 310 | border-bottom: 0; 311 | } 312 | .ui-datepicker .ui-datepicker-buttonpane button { 313 | float: right; 314 | margin: .5em .2em .4em; 315 | cursor: pointer; 316 | padding: .2em .6em .3em .6em; 317 | width: auto; 318 | overflow: visible; 319 | } 320 | .ui-datepicker .ui-datepicker-buttonpane button.ui-datepicker-current { 321 | float: left; 322 | } 323 | 324 | /* with multiple calendars */ 325 | .ui-datepicker.ui-datepicker-multi { 326 | width: auto; 327 | } 328 | .ui-datepicker-multi .ui-datepicker-group { 329 | float: left; 330 | } 331 | .ui-datepicker-multi .ui-datepicker-group table { 332 | width: 95%; 333 | margin: 0 auto .4em; 334 | } 335 | .ui-datepicker-multi-2 .ui-datepicker-group { 336 | width: 50%; 337 | } 338 | .ui-datepicker-multi-3 .ui-datepicker-group { 339 | width: 33.3%; 340 | } 341 | .ui-datepicker-multi-4 .ui-datepicker-group { 342 | width: 25%; 343 | } 344 | .ui-datepicker-multi .ui-datepicker-group-last .ui-datepicker-header, 345 | .ui-datepicker-multi .ui-datepicker-group-middle .ui-datepicker-header { 346 | border-left-width: 0; 347 | } 348 | .ui-datepicker-multi .ui-datepicker-buttonpane { 349 | clear: left; 350 | } 351 | .ui-datepicker-row-break { 352 | clear: both; 353 | width: 100%; 354 | font-size: 0; 355 | } 356 | 357 | /* RTL support */ 358 | .ui-datepicker-rtl { 359 | direction: rtl; 360 | } 361 | .ui-datepicker-rtl .ui-datepicker-prev { 362 | right: 2px; 363 | left: auto; 364 | } 365 | .ui-datepicker-rtl .ui-datepicker-next { 366 | left: 2px; 367 | right: auto; 368 | } 369 | .ui-datepicker-rtl .ui-datepicker-prev:hover { 370 | right: 1px; 371 | left: auto; 372 | } 373 | .ui-datepicker-rtl .ui-datepicker-next:hover { 374 | left: 1px; 375 | right: auto; 376 | } 377 | .ui-datepicker-rtl .ui-datepicker-buttonpane { 378 | clear: right; 379 | } 380 | .ui-datepicker-rtl .ui-datepicker-buttonpane button { 381 | float: left; 382 | } 383 | .ui-datepicker-rtl .ui-datepicker-buttonpane button.ui-datepicker-current, 384 | .ui-datepicker-rtl .ui-datepicker-group { 385 | float: right; 386 | } 387 | .ui-datepicker-rtl .ui-datepicker-group-last .ui-datepicker-header, 388 | .ui-datepicker-rtl .ui-datepicker-group-middle .ui-datepicker-header { 389 | border-right-width: 0; 390 | border-left-width: 1px; 391 | } 392 | .ui-dialog { 393 | overflow: hidden; 394 | position: absolute; 395 | top: 0; 396 | left: 0; 397 | padding: .2em; 398 | outline: 0; 399 | } 400 | .ui-dialog .ui-dialog-titlebar { 401 | padding: .4em 1em; 402 | position: relative; 403 | } 404 | .ui-dialog .ui-dialog-title { 405 | float: left; 406 | margin: .1em 0; 407 | white-space: nowrap; 408 | width: 90%; 409 | overflow: hidden; 410 | text-overflow: ellipsis; 411 | } 412 | .ui-dialog .ui-dialog-titlebar-close { 413 | position: absolute; 414 | right: .3em; 415 | top: 50%; 416 | width: 20px; 417 | margin: -10px 0 0 0; 418 | padding: 1px; 419 | height: 20px; 420 | } 421 | .ui-dialog .ui-dialog-content { 422 | position: relative; 423 | border: 0; 424 | padding: .5em 1em; 425 | background: none; 426 | overflow: auto; 427 | } 428 | .ui-dialog .ui-dialog-buttonpane { 429 | text-align: left; 430 | border-width: 1px 0 0 0; 431 | background-image: none; 432 | margin-top: .5em; 433 | padding: .3em 1em .5em .4em; 434 | } 435 | .ui-dialog .ui-dialog-buttonpane .ui-dialog-buttonset { 436 | float: right; 437 | } 438 | .ui-dialog .ui-dialog-buttonpane button { 439 | margin: .5em .4em .5em 0; 440 | cursor: pointer; 441 | } 442 | .ui-dialog .ui-resizable-se { 443 | width: 12px; 444 | height: 12px; 445 | right: -5px; 446 | bottom: -5px; 447 | background-position: 16px 16px; 448 | } 449 | .ui-draggable .ui-dialog-titlebar { 450 | cursor: move; 451 | } 452 | .ui-menu { 453 | list-style: none; 454 | padding: 2px; 455 | margin: 0; 456 | display: block; 457 | outline: none; 458 | } 459 | .ui-menu .ui-menu { 460 | margin-top: -3px; 461 | position: absolute; 462 | } 463 | .ui-menu .ui-menu-item { 464 | margin: 0; 465 | padding: 0; 466 | width: 100%; 467 | /* support: IE10, see #8844 */ 468 | list-style-image: url(data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7); 469 | } 470 | .ui-menu .ui-menu-divider { 471 | margin: 5px -2px 5px -2px; 472 | height: 0; 473 | font-size: 0; 474 | line-height: 0; 475 | border-width: 1px 0 0 0; 476 | } 477 | .ui-menu .ui-menu-item a { 478 | text-decoration: none; 479 | display: block; 480 | padding: 2px .4em; 481 | line-height: 1.5; 482 | min-height: 0; /* support: IE7 */ 483 | font-weight: normal; 484 | } 485 | .ui-menu .ui-menu-item a.ui-state-focus, 486 | .ui-menu .ui-menu-item a.ui-state-active { 487 | font-weight: normal; 488 | margin: -1px; 489 | } 490 | 491 | .ui-menu .ui-state-disabled { 492 | font-weight: normal; 493 | margin: .4em 0 .2em; 494 | line-height: 1.5; 495 | } 496 | .ui-menu .ui-state-disabled a { 497 | cursor: default; 498 | } 499 | 500 | /* icon support */ 501 | .ui-menu-icons { 502 | position: relative; 503 | } 504 | .ui-menu-icons .ui-menu-item a { 505 | position: relative; 506 | padding-left: 2em; 507 | } 508 | 509 | /* left-aligned */ 510 | .ui-menu .ui-icon { 511 | position: absolute; 512 | top: .2em; 513 | left: .2em; 514 | } 515 | 516 | /* right-aligned */ 517 | .ui-menu .ui-menu-icon { 518 | position: static; 519 | float: right; 520 | } 521 | .ui-progressbar { 522 | height: 2em; 523 | text-align: left; 524 | overflow: hidden; 525 | } 526 | .ui-progressbar .ui-progressbar-value { 527 | margin: -1px; 528 | height: 100%; 529 | } 530 | .ui-progressbar .ui-progressbar-overlay { 531 | background: url("images/animated-overlay.gif"); 532 | height: 100%; 533 | filter: alpha(opacity=25); 534 | opacity: 0.25; 535 | } 536 | .ui-progressbar-indeterminate .ui-progressbar-value { 537 | background-image: none; 538 | } 539 | .ui-resizable { 540 | position: relative; 541 | } 542 | .ui-resizable-handle { 543 | position: absolute; 544 | font-size: 0.1px; 545 | display: block; 546 | } 547 | .ui-resizable-disabled .ui-resizable-handle, 548 | .ui-resizable-autohide .ui-resizable-handle { 549 | display: none; 550 | } 551 | .ui-resizable-n { 552 | cursor: n-resize; 553 | height: 7px; 554 | width: 100%; 555 | top: -5px; 556 | left: 0; 557 | } 558 | .ui-resizable-s { 559 | cursor: s-resize; 560 | height: 7px; 561 | width: 100%; 562 | bottom: -5px; 563 | left: 0; 564 | } 565 | .ui-resizable-e { 566 | cursor: e-resize; 567 | width: 7px; 568 | right: -5px; 569 | top: 0; 570 | height: 100%; 571 | } 572 | .ui-resizable-w { 573 | cursor: w-resize; 574 | width: 7px; 575 | left: -5px; 576 | top: 0; 577 | height: 100%; 578 | } 579 | .ui-resizable-se { 580 | cursor: se-resize; 581 | width: 12px; 582 | height: 12px; 583 | right: 1px; 584 | bottom: 1px; 585 | } 586 | .ui-resizable-sw { 587 | cursor: sw-resize; 588 | width: 9px; 589 | height: 9px; 590 | left: -5px; 591 | bottom: -5px; 592 | } 593 | .ui-resizable-nw { 594 | cursor: nw-resize; 595 | width: 9px; 596 | height: 9px; 597 | left: -5px; 598 | top: -5px; 599 | } 600 | .ui-resizable-ne { 601 | cursor: ne-resize; 602 | width: 9px; 603 | height: 9px; 604 | right: -5px; 605 | top: -5px; 606 | } 607 | .ui-selectable-helper { 608 | position: absolute; 609 | z-index: 100; 610 | border: 1px dotted black; 611 | } 612 | .ui-slider { 613 | position: relative; 614 | text-align: left; 615 | } 616 | .ui-slider .ui-slider-handle { 617 | position: absolute; 618 | z-index: 2; 619 | width: 1.2em; 620 | height: 1.2em; 621 | cursor: default; 622 | } 623 | .ui-slider .ui-slider-range { 624 | position: absolute; 625 | z-index: 1; 626 | font-size: .7em; 627 | display: block; 628 | border: 0; 629 | background-position: 0 0; 630 | } 631 | 632 | /* For IE8 - See #6727 */ 633 | .ui-slider.ui-state-disabled .ui-slider-handle, 634 | .ui-slider.ui-state-disabled .ui-slider-range { 635 | filter: inherit; 636 | } 637 | 638 | .ui-slider-horizontal { 639 | height: .8em; 640 | } 641 | .ui-slider-horizontal .ui-slider-handle { 642 | top: -.3em; 643 | margin-left: -.6em; 644 | } 645 | .ui-slider-horizontal .ui-slider-range { 646 | top: 0; 647 | height: 100%; 648 | } 649 | .ui-slider-horizontal .ui-slider-range-min { 650 | left: 0; 651 | } 652 | .ui-slider-horizontal .ui-slider-range-max { 653 | right: 0; 654 | } 655 | 656 | .ui-slider-vertical { 657 | width: .8em; 658 | height: 100px; 659 | } 660 | .ui-slider-vertical .ui-slider-handle { 661 | left: -.3em; 662 | margin-left: 0; 663 | margin-bottom: -.6em; 664 | } 665 | .ui-slider-vertical .ui-slider-range { 666 | left: 0; 667 | width: 100%; 668 | } 669 | .ui-slider-vertical .ui-slider-range-min { 670 | bottom: 0; 671 | } 672 | .ui-slider-vertical .ui-slider-range-max { 673 | top: 0; 674 | } 675 | .ui-spinner { 676 | position: relative; 677 | display: inline-block; 678 | overflow: hidden; 679 | padding: 0; 680 | vertical-align: middle; 681 | } 682 | .ui-spinner-input { 683 | border: none; 684 | background: none; 685 | color: inherit; 686 | padding: 0; 687 | margin: .2em 0; 688 | vertical-align: middle; 689 | margin-left: .4em; 690 | margin-right: 22px; 691 | } 692 | .ui-spinner-button { 693 | width: 16px; 694 | height: 50%; 695 | font-size: .5em; 696 | padding: 0; 697 | margin: 0; 698 | text-align: center; 699 | position: absolute; 700 | cursor: default; 701 | display: block; 702 | overflow: hidden; 703 | right: 0; 704 | } 705 | /* more specificity required here to override default borders */ 706 | .ui-spinner a.ui-spinner-button { 707 | border-top: none; 708 | border-bottom: none; 709 | border-right: none; 710 | } 711 | /* vertically center icon */ 712 | .ui-spinner .ui-icon { 713 | position: absolute; 714 | margin-top: -8px; 715 | top: 50%; 716 | left: 0; 717 | } 718 | .ui-spinner-up { 719 | top: 0; 720 | } 721 | .ui-spinner-down { 722 | bottom: 0; 723 | } 724 | 725 | /* TR overrides */ 726 | .ui-spinner .ui-icon-triangle-1-s { 727 | /* need to fix icons sprite */ 728 | background-position: -65px -16px; 729 | } 730 | .ui-tabs { 731 | position: relative;/* position: relative prevents IE scroll bug (element with position: relative inside container with overflow: auto appear as "fixed") */ 732 | padding: .2em; 733 | } 734 | .ui-tabs .ui-tabs-nav { 735 | margin: 0; 736 | padding: .2em .2em 0; 737 | } 738 | .ui-tabs .ui-tabs-nav li { 739 | list-style: none; 740 | float: left; 741 | position: relative; 742 | top: 0; 743 | margin: 1px .2em 0 0; 744 | border-bottom-width: 0; 745 | padding: 0; 746 | white-space: nowrap; 747 | } 748 | .ui-tabs .ui-tabs-nav .ui-tabs-anchor { 749 | float: left; 750 | padding: .5em 1em; 751 | text-decoration: none; 752 | } 753 | .ui-tabs .ui-tabs-nav li.ui-tabs-active { 754 | margin-bottom: -1px; 755 | padding-bottom: 1px; 756 | } 757 | .ui-tabs .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor, 758 | .ui-tabs .ui-tabs-nav li.ui-state-disabled .ui-tabs-anchor, 759 | .ui-tabs .ui-tabs-nav li.ui-tabs-loading .ui-tabs-anchor { 760 | cursor: text; 761 | } 762 | .ui-tabs-collapsible .ui-tabs-nav li.ui-tabs-active .ui-tabs-anchor { 763 | cursor: pointer; 764 | } 765 | .ui-tabs .ui-tabs-panel { 766 | display: block; 767 | border-width: 0; 768 | padding: 1em 1.4em; 769 | background: none; 770 | } 771 | .ui-tooltip { 772 | padding: 8px; 773 | position: absolute; 774 | z-index: 9999; 775 | max-width: 300px; 776 | -webkit-box-shadow: 0 0 5px #aaa; 777 | box-shadow: 0 0 5px #aaa; 778 | } 779 | body .ui-tooltip { 780 | border-width: 2px; 781 | } 782 | 783 | /* Component containers 784 | ----------------------------------*/ 785 | .ui-widget { 786 | font-family: Verdana,Arial,sans-serif; 787 | font-size: 1.1em; 788 | } 789 | .ui-widget .ui-widget { 790 | font-size: 1em; 791 | } 792 | .ui-widget input, 793 | .ui-widget select, 794 | .ui-widget textarea, 795 | .ui-widget button { 796 | font-family: Verdana,Arial,sans-serif; 797 | font-size: 1em; 798 | } 799 | .ui-widget-content { 800 | border: 1px solid #aaaaaa; 801 | background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; 802 | color: #222222; 803 | } 804 | .ui-widget-content a { 805 | color: #222222; 806 | } 807 | .ui-widget-header { 808 | border: 1px solid #aaaaaa; 809 | background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; 810 | color: #222222; 811 | font-weight: bold; 812 | } 813 | .ui-widget-header a { 814 | color: #222222; 815 | } 816 | 817 | /* Interaction states 818 | ----------------------------------*/ 819 | .ui-state-default, 820 | .ui-widget-content .ui-state-default, 821 | .ui-widget-header .ui-state-default { 822 | border: 1px solid #d3d3d3; 823 | background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; 824 | font-weight: normal; 825 | color: #555555; 826 | } 827 | .ui-state-default a, 828 | .ui-state-default a:link, 829 | .ui-state-default a:visited { 830 | color: #555555; 831 | text-decoration: none; 832 | } 833 | .ui-state-hover, 834 | .ui-widget-content .ui-state-hover, 835 | .ui-widget-header .ui-state-hover, 836 | .ui-state-focus, 837 | .ui-widget-content .ui-state-focus, 838 | .ui-widget-header .ui-state-focus { 839 | border: 1px solid #999999; 840 | background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; 841 | font-weight: normal; 842 | color: #212121; 843 | } 844 | .ui-state-hover a, 845 | .ui-state-hover a:hover, 846 | .ui-state-hover a:link, 847 | .ui-state-hover a:visited, 848 | .ui-state-focus a, 849 | .ui-state-focus a:hover, 850 | .ui-state-focus a:link, 851 | .ui-state-focus a:visited { 852 | color: #212121; 853 | text-decoration: none; 854 | } 855 | .ui-state-active, 856 | .ui-widget-content .ui-state-active, 857 | .ui-widget-header .ui-state-active { 858 | border: 1px solid #aaaaaa; 859 | background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; 860 | font-weight: normal; 861 | color: #212121; 862 | } 863 | .ui-state-active a, 864 | .ui-state-active a:link, 865 | .ui-state-active a:visited { 866 | color: #212121; 867 | text-decoration: none; 868 | } 869 | 870 | /* Interaction Cues 871 | ----------------------------------*/ 872 | .ui-state-highlight, 873 | .ui-widget-content .ui-state-highlight, 874 | .ui-widget-header .ui-state-highlight { 875 | border: 1px solid #fcefa1; 876 | background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; 877 | color: #363636; 878 | } 879 | .ui-state-highlight a, 880 | .ui-widget-content .ui-state-highlight a, 881 | .ui-widget-header .ui-state-highlight a { 882 | color: #363636; 883 | } 884 | .ui-state-error, 885 | .ui-widget-content .ui-state-error, 886 | .ui-widget-header .ui-state-error { 887 | border: 1px solid #cd0a0a; 888 | background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; 889 | color: #cd0a0a; 890 | } 891 | .ui-state-error a, 892 | .ui-widget-content .ui-state-error a, 893 | .ui-widget-header .ui-state-error a { 894 | color: #cd0a0a; 895 | } 896 | .ui-state-error-text, 897 | .ui-widget-content .ui-state-error-text, 898 | .ui-widget-header .ui-state-error-text { 899 | color: #cd0a0a; 900 | } 901 | .ui-priority-primary, 902 | .ui-widget-content .ui-priority-primary, 903 | .ui-widget-header .ui-priority-primary { 904 | font-weight: bold; 905 | } 906 | .ui-priority-secondary, 907 | .ui-widget-content .ui-priority-secondary, 908 | .ui-widget-header .ui-priority-secondary { 909 | opacity: .7; 910 | filter:Alpha(Opacity=70); 911 | font-weight: normal; 912 | } 913 | .ui-state-disabled, 914 | .ui-widget-content .ui-state-disabled, 915 | .ui-widget-header .ui-state-disabled { 916 | opacity: .35; 917 | filter:Alpha(Opacity=35); 918 | background-image: none; 919 | } 920 | .ui-state-disabled .ui-icon { 921 | filter:Alpha(Opacity=35); /* For IE8 - See #6059 */ 922 | } 923 | 924 | /* Icons 925 | ----------------------------------*/ 926 | 927 | /* states and images */ 928 | .ui-icon { 929 | width: 16px; 930 | height: 16px; 931 | } 932 | .ui-icon, 933 | .ui-widget-content .ui-icon { 934 | background-image: url(images/ui-icons_222222_256x240.png); 935 | } 936 | .ui-widget-header .ui-icon { 937 | background-image: url(images/ui-icons_222222_256x240.png); 938 | } 939 | .ui-state-default .ui-icon { 940 | background-image: url(images/ui-icons_888888_256x240.png); 941 | } 942 | .ui-state-hover .ui-icon, 943 | .ui-state-focus .ui-icon { 944 | background-image: url(images/ui-icons_454545_256x240.png); 945 | } 946 | .ui-state-active .ui-icon { 947 | background-image: url(images/ui-icons_454545_256x240.png); 948 | } 949 | .ui-state-highlight .ui-icon { 950 | background-image: url(images/ui-icons_2e83ff_256x240.png); 951 | } 952 | .ui-state-error .ui-icon, 953 | .ui-state-error-text .ui-icon { 954 | background-image: url(images/ui-icons_cd0a0a_256x240.png); 955 | } 956 | 957 | /* positioning */ 958 | .ui-icon-blank { background-position: 16px 16px; } 959 | .ui-icon-carat-1-n { background-position: 0 0; } 960 | .ui-icon-carat-1-ne { background-position: -16px 0; } 961 | .ui-icon-carat-1-e { background-position: -32px 0; } 962 | .ui-icon-carat-1-se { background-position: -48px 0; } 963 | .ui-icon-carat-1-s { background-position: -64px 0; } 964 | .ui-icon-carat-1-sw { background-position: -80px 0; } 965 | .ui-icon-carat-1-w { background-position: -96px 0; } 966 | .ui-icon-carat-1-nw { background-position: -112px 0; } 967 | .ui-icon-carat-2-n-s { background-position: -128px 0; } 968 | .ui-icon-carat-2-e-w { background-position: -144px 0; } 969 | .ui-icon-triangle-1-n { background-position: 0 -16px; } 970 | .ui-icon-triangle-1-ne { background-position: -16px -16px; } 971 | .ui-icon-triangle-1-e { background-position: -32px -16px; } 972 | .ui-icon-triangle-1-se { background-position: -48px -16px; } 973 | .ui-icon-triangle-1-s { background-position: -64px -16px; } 974 | .ui-icon-triangle-1-sw { background-position: -80px -16px; } 975 | .ui-icon-triangle-1-w { background-position: -96px -16px; } 976 | .ui-icon-triangle-1-nw { background-position: -112px -16px; } 977 | .ui-icon-triangle-2-n-s { background-position: -128px -16px; } 978 | .ui-icon-triangle-2-e-w { background-position: -144px -16px; } 979 | .ui-icon-arrow-1-n { background-position: 0 -32px; } 980 | .ui-icon-arrow-1-ne { background-position: -16px -32px; } 981 | .ui-icon-arrow-1-e { background-position: -32px -32px; } 982 | .ui-icon-arrow-1-se { background-position: -48px -32px; } 983 | .ui-icon-arrow-1-s { background-position: -64px -32px; } 984 | .ui-icon-arrow-1-sw { background-position: -80px -32px; } 985 | .ui-icon-arrow-1-w { background-position: -96px -32px; } 986 | .ui-icon-arrow-1-nw { background-position: -112px -32px; } 987 | .ui-icon-arrow-2-n-s { background-position: -128px -32px; } 988 | .ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } 989 | .ui-icon-arrow-2-e-w { background-position: -160px -32px; } 990 | .ui-icon-arrow-2-se-nw { background-position: -176px -32px; } 991 | .ui-icon-arrowstop-1-n { background-position: -192px -32px; } 992 | .ui-icon-arrowstop-1-e { background-position: -208px -32px; } 993 | .ui-icon-arrowstop-1-s { background-position: -224px -32px; } 994 | .ui-icon-arrowstop-1-w { background-position: -240px -32px; } 995 | .ui-icon-arrowthick-1-n { background-position: 0 -48px; } 996 | .ui-icon-arrowthick-1-ne { background-position: -16px -48px; } 997 | .ui-icon-arrowthick-1-e { background-position: -32px -48px; } 998 | .ui-icon-arrowthick-1-se { background-position: -48px -48px; } 999 | .ui-icon-arrowthick-1-s { background-position: -64px -48px; } 1000 | .ui-icon-arrowthick-1-sw { background-position: -80px -48px; } 1001 | .ui-icon-arrowthick-1-w { background-position: -96px -48px; } 1002 | .ui-icon-arrowthick-1-nw { background-position: -112px -48px; } 1003 | .ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } 1004 | .ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } 1005 | .ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } 1006 | .ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } 1007 | .ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } 1008 | .ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } 1009 | .ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } 1010 | .ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } 1011 | .ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } 1012 | .ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } 1013 | .ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } 1014 | .ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } 1015 | .ui-icon-arrowreturn-1-w { background-position: -64px -64px; } 1016 | .ui-icon-arrowreturn-1-n { background-position: -80px -64px; } 1017 | .ui-icon-arrowreturn-1-e { background-position: -96px -64px; } 1018 | .ui-icon-arrowreturn-1-s { background-position: -112px -64px; } 1019 | .ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } 1020 | .ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } 1021 | .ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } 1022 | .ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } 1023 | .ui-icon-arrow-4 { background-position: 0 -80px; } 1024 | .ui-icon-arrow-4-diag { background-position: -16px -80px; } 1025 | .ui-icon-extlink { background-position: -32px -80px; } 1026 | .ui-icon-newwin { background-position: -48px -80px; } 1027 | .ui-icon-refresh { background-position: -64px -80px; } 1028 | .ui-icon-shuffle { background-position: -80px -80px; } 1029 | .ui-icon-transfer-e-w { background-position: -96px -80px; } 1030 | .ui-icon-transferthick-e-w { background-position: -112px -80px; } 1031 | .ui-icon-folder-collapsed { background-position: 0 -96px; } 1032 | .ui-icon-folder-open { background-position: -16px -96px; } 1033 | .ui-icon-document { background-position: -32px -96px; } 1034 | .ui-icon-document-b { background-position: -48px -96px; } 1035 | .ui-icon-note { background-position: -64px -96px; } 1036 | .ui-icon-mail-closed { background-position: -80px -96px; } 1037 | .ui-icon-mail-open { background-position: -96px -96px; } 1038 | .ui-icon-suitcase { background-position: -112px -96px; } 1039 | .ui-icon-comment { background-position: -128px -96px; } 1040 | .ui-icon-person { background-position: -144px -96px; } 1041 | .ui-icon-print { background-position: -160px -96px; } 1042 | .ui-icon-trash { background-position: -176px -96px; } 1043 | .ui-icon-locked { background-position: -192px -96px; } 1044 | .ui-icon-unlocked { background-position: -208px -96px; } 1045 | .ui-icon-bookmark { background-position: -224px -96px; } 1046 | .ui-icon-tag { background-position: -240px -96px; } 1047 | .ui-icon-home { background-position: 0 -112px; } 1048 | .ui-icon-flag { background-position: -16px -112px; } 1049 | .ui-icon-calendar { background-position: -32px -112px; } 1050 | .ui-icon-cart { background-position: -48px -112px; } 1051 | .ui-icon-pencil { background-position: -64px -112px; } 1052 | .ui-icon-clock { background-position: -80px -112px; } 1053 | .ui-icon-disk { background-position: -96px -112px; } 1054 | .ui-icon-calculator { background-position: -112px -112px; } 1055 | .ui-icon-zoomin { background-position: -128px -112px; } 1056 | .ui-icon-zoomout { background-position: -144px -112px; } 1057 | .ui-icon-search { background-position: -160px -112px; } 1058 | .ui-icon-wrench { background-position: -176px -112px; } 1059 | .ui-icon-gear { background-position: -192px -112px; } 1060 | .ui-icon-heart { background-position: -208px -112px; } 1061 | .ui-icon-star { background-position: -224px -112px; } 1062 | .ui-icon-link { background-position: -240px -112px; } 1063 | .ui-icon-cancel { background-position: 0 -128px; } 1064 | .ui-icon-plus { background-position: -16px -128px; } 1065 | .ui-icon-plusthick { background-position: -32px -128px; } 1066 | .ui-icon-minus { background-position: -48px -128px; } 1067 | .ui-icon-minusthick { background-position: -64px -128px; } 1068 | .ui-icon-close { background-position: -80px -128px; } 1069 | .ui-icon-closethick { background-position: -96px -128px; } 1070 | .ui-icon-key { background-position: -112px -128px; } 1071 | .ui-icon-lightbulb { background-position: -128px -128px; } 1072 | .ui-icon-scissors { background-position: -144px -128px; } 1073 | .ui-icon-clipboard { background-position: -160px -128px; } 1074 | .ui-icon-copy { background-position: -176px -128px; } 1075 | .ui-icon-contact { background-position: -192px -128px; } 1076 | .ui-icon-image { background-position: -208px -128px; } 1077 | .ui-icon-video { background-position: -224px -128px; } 1078 | .ui-icon-script { background-position: -240px -128px; } 1079 | .ui-icon-alert { background-position: 0 -144px; } 1080 | .ui-icon-info { background-position: -16px -144px; } 1081 | .ui-icon-notice { background-position: -32px -144px; } 1082 | .ui-icon-help { background-position: -48px -144px; } 1083 | .ui-icon-check { background-position: -64px -144px; } 1084 | .ui-icon-bullet { background-position: -80px -144px; } 1085 | .ui-icon-radio-on { background-position: -96px -144px; } 1086 | .ui-icon-radio-off { background-position: -112px -144px; } 1087 | .ui-icon-pin-w { background-position: -128px -144px; } 1088 | .ui-icon-pin-s { background-position: -144px -144px; } 1089 | .ui-icon-play { background-position: 0 -160px; } 1090 | .ui-icon-pause { background-position: -16px -160px; } 1091 | .ui-icon-seek-next { background-position: -32px -160px; } 1092 | .ui-icon-seek-prev { background-position: -48px -160px; } 1093 | .ui-icon-seek-end { background-position: -64px -160px; } 1094 | .ui-icon-seek-start { background-position: -80px -160px; } 1095 | /* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ 1096 | .ui-icon-seek-first { background-position: -80px -160px; } 1097 | .ui-icon-stop { background-position: -96px -160px; } 1098 | .ui-icon-eject { background-position: -112px -160px; } 1099 | .ui-icon-volume-off { background-position: -128px -160px; } 1100 | .ui-icon-volume-on { background-position: -144px -160px; } 1101 | .ui-icon-power { background-position: 0 -176px; } 1102 | .ui-icon-signal-diag { background-position: -16px -176px; } 1103 | .ui-icon-signal { background-position: -32px -176px; } 1104 | .ui-icon-battery-0 { background-position: -48px -176px; } 1105 | .ui-icon-battery-1 { background-position: -64px -176px; } 1106 | .ui-icon-battery-2 { background-position: -80px -176px; } 1107 | .ui-icon-battery-3 { background-position: -96px -176px; } 1108 | .ui-icon-circle-plus { background-position: 0 -192px; } 1109 | .ui-icon-circle-minus { background-position: -16px -192px; } 1110 | .ui-icon-circle-close { background-position: -32px -192px; } 1111 | .ui-icon-circle-triangle-e { background-position: -48px -192px; } 1112 | .ui-icon-circle-triangle-s { background-position: -64px -192px; } 1113 | .ui-icon-circle-triangle-w { background-position: -80px -192px; } 1114 | .ui-icon-circle-triangle-n { background-position: -96px -192px; } 1115 | .ui-icon-circle-arrow-e { background-position: -112px -192px; } 1116 | .ui-icon-circle-arrow-s { background-position: -128px -192px; } 1117 | .ui-icon-circle-arrow-w { background-position: -144px -192px; } 1118 | .ui-icon-circle-arrow-n { background-position: -160px -192px; } 1119 | .ui-icon-circle-zoomin { background-position: -176px -192px; } 1120 | .ui-icon-circle-zoomout { background-position: -192px -192px; } 1121 | .ui-icon-circle-check { background-position: -208px -192px; } 1122 | .ui-icon-circlesmall-plus { background-position: 0 -208px; } 1123 | .ui-icon-circlesmall-minus { background-position: -16px -208px; } 1124 | .ui-icon-circlesmall-close { background-position: -32px -208px; } 1125 | .ui-icon-squaresmall-plus { background-position: -48px -208px; } 1126 | .ui-icon-squaresmall-minus { background-position: -64px -208px; } 1127 | .ui-icon-squaresmall-close { background-position: -80px -208px; } 1128 | .ui-icon-grip-dotted-vertical { background-position: 0 -224px; } 1129 | .ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } 1130 | .ui-icon-grip-solid-vertical { background-position: -32px -224px; } 1131 | .ui-icon-grip-solid-horizontal { background-position: -48px -224px; } 1132 | .ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } 1133 | .ui-icon-grip-diagonal-se { background-position: -80px -224px; } 1134 | 1135 | 1136 | /* Misc visuals 1137 | ----------------------------------*/ 1138 | 1139 | /* Corner radius */ 1140 | .ui-corner-all, 1141 | .ui-corner-top, 1142 | .ui-corner-left, 1143 | .ui-corner-tl { 1144 | border-top-left-radius: 4px; 1145 | } 1146 | .ui-corner-all, 1147 | .ui-corner-top, 1148 | .ui-corner-right, 1149 | .ui-corner-tr { 1150 | border-top-right-radius: 4px; 1151 | } 1152 | .ui-corner-all, 1153 | .ui-corner-bottom, 1154 | .ui-corner-left, 1155 | .ui-corner-bl { 1156 | border-bottom-left-radius: 4px; 1157 | } 1158 | .ui-corner-all, 1159 | .ui-corner-bottom, 1160 | .ui-corner-right, 1161 | .ui-corner-br { 1162 | border-bottom-right-radius: 4px; 1163 | } 1164 | 1165 | /* Overlays */ 1166 | .ui-widget-overlay { 1167 | background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; 1168 | opacity: .3; 1169 | filter: Alpha(Opacity=30); 1170 | } 1171 | .ui-widget-shadow { 1172 | margin: -8px 0 0 -8px; 1173 | padding: 8px; 1174 | background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; 1175 | opacity: .3; 1176 | filter: Alpha(Opacity=30); 1177 | border-radius: 8px; 1178 | } 1179 | -------------------------------------------------------------------------------- /sentrygund/static/css/sentrygund/global.css: -------------------------------------------------------------------------------- 1 | /* Custom CSS should go here 2 | */ 3 | -------------------------------------------------------------------------------- /sentrygund/static/img/stub: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/s0lst1c3/sentrygun-server/cbbfcafa0356d80c327490ff1dae528219a3efa8/sentrygund/static/img/stub -------------------------------------------------------------------------------- /sentrygund/static/js/jquery.sidebar.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * jQuery sidebar plugin 3 | * --------------------- 4 | * A stupid simple sidebar jQuery plugin. 5 | * 6 | * Developed with <3 and JavaScript by the jillix developers. 7 | * Copyright (c) 2013-15 jillix 8 | * */ 9 | (function($) { 10 | 11 | /** 12 | * sidebar 13 | * Initialize sidebar on selected elements. 14 | * 15 | * ```js 16 | * $(".my-sidebar").sidebar({...}); 17 | * ``` 18 | * 19 | * After the call above, you can programatically open/close/toggle the sidebar using: 20 | * 21 | * ```js 22 | * $(".my-sidebar").trigger("sidebar:open"); 23 | * $(".my-sidebar").trigger("sidebar:close"); 24 | * $(".my-sidebar").trigger("sidebar:toggle"); 25 | * $(".my-sidebar").trigger("sidebar:close", [{ speed: 0 }]); 26 | * ``` 27 | * 28 | * After the sidebar is opened/closed, `sidebar:opened`/`sidebar:closed` event is emitted. 29 | * 30 | * ```js 31 | * $(".my-sidebar").on("sidebar:opened", function () { 32 | * // Do something on open 33 | * }); 34 | * 35 | * $(".my-sidebar").on("sidebar:closed", function () { 36 | * // Do something on close 37 | * }); 38 | * ``` 39 | * 40 | * @name sidebar 41 | * @function 42 | * @param {Object} options An object that will be merged with the default options. 43 | * 44 | * - `speed` (Number): animation speed (default: `200`) 45 | * - `side` (String): left|right|top|bottom (default: `"left"`) 46 | * - `isClosed` (Boolean): A boolean value indicating if the sidebar is closed or not (default: `false`). 47 | * - `close` (Boolean): If `true`, the sidebar will be closed by default. 48 | * 49 | * @return {jQuery} The jQuery elements that were selected. 50 | */ 51 | $.fn.sidebar = function(options) { 52 | 53 | var self = this; 54 | if (self.length > 1) { 55 | return self.each(function () { 56 | $(this).sidebar(options); 57 | }); 58 | } 59 | 60 | // Width, height 61 | var width = self.outerWidth(); 62 | var height = self.outerHeight(); 63 | 64 | // Defaults 65 | var settings = $.extend({ 66 | 67 | // Animation speed 68 | speed: 200, 69 | 70 | // Side: left|right|top|bottom 71 | side: "left", 72 | 73 | // Is closed 74 | isClosed: false, 75 | 76 | // Should I close the sidebar? 77 | close: true 78 | 79 | }, options); 80 | 81 | /*! 82 | * Opens the sidebar 83 | * $([jQuery selector]).trigger("sidebar:open"); 84 | * */ 85 | self.on("sidebar:open", function(ev, data) { 86 | var properties = {}; 87 | properties[settings.side] = 0; 88 | settings.isClosed = null; 89 | self.stop().animate(properties, $.extend({}, settings, data).speed, function() { 90 | settings.isClosed = false; 91 | self.trigger("sidebar:opened"); 92 | }); 93 | }); 94 | 95 | 96 | /*! 97 | * Closes the sidebar 98 | * $("[jQuery selector]).trigger("sidebar:close"); 99 | * */ 100 | self.on("sidebar:close", function(ev, data) { 101 | var properties = {}; 102 | if (settings.side === "left" || settings.side === "right") { 103 | properties[settings.side] = -self.outerWidth(); 104 | } else { 105 | properties[settings.side] = -self.outerHeight(); 106 | } 107 | settings.isClosed = null; 108 | self.stop().animate(properties, $.extend({}, settings, data).speed, function() { 109 | settings.isClosed = true; 110 | self.trigger("sidebar:closed"); 111 | }); 112 | }); 113 | 114 | /*! 115 | * Toggles the sidebar 116 | * $("[jQuery selector]).trigger("sidebar:toggle"); 117 | * */ 118 | self.on("sidebar:toggle", function(ev, data) { 119 | if (settings.isClosed) { 120 | self.trigger("sidebar:open", [data]); 121 | } else { 122 | self.trigger("sidebar:close", [data]); 123 | } 124 | }); 125 | 126 | function closeWithNoAnimation() { 127 | self.trigger("sidebar:close", [{ 128 | speed: 0 129 | }]); 130 | } 131 | 132 | // Close the sidebar 133 | if (!settings.isClosed && settings.close) { 134 | closeWithNoAnimation(); 135 | } 136 | 137 | $(window).on("resize", function () { 138 | if (!settings.isClosed) { return; } 139 | closeWithNoAnimation(); 140 | }); 141 | 142 | self.data("sidebar", settings); 143 | 144 | return self; 145 | }; 146 | 147 | // Version 148 | $.fn.sidebar.version = "3.3.2"; 149 | })(jQuery); 150 | -------------------------------------------------------------------------------- /sentrygund/static/js/jquery.sidebar.min.js: -------------------------------------------------------------------------------- 1 | (function($){$.fn.sidebar=function(options){var self=this;if(self.length>1){return self.each(function(){$(this).sidebar(options)})}var width=self.outerWidth();var height=self.outerHeight();var settings=$.extend({speed:200,side:"left",isClosed:false,close:true},options);self.on("sidebar:open",function(ev,data){var properties={};properties[settings.side]=0;settings.isClosed=null;self.stop().animate(properties,$.extend({},settings,data).speed,function(){settings.isClosed=false;self.trigger("sidebar:opened")})});self.on("sidebar:close",function(ev,data){var properties={};if(settings.side==="left"||settings.side==="right"){properties[settings.side]=-self.outerWidth()}else{properties[settings.side]=-self.outerHeight()}settings.isClosed=null;self.stop().animate(properties,$.extend({},settings,data).speed,function(){settings.isClosed=true;self.trigger("sidebar:closed")})});self.on("sidebar:toggle",function(ev,data){if(settings.isClosed){self.trigger("sidebar:open",[data])}else{self.trigger("sidebar:close",[data])}});function closeWithNoAnimation(){self.trigger("sidebar:close",[{speed:0}])}if(!settings.isClosed&&settings.close){closeWithNoAnimation()}$(window).on("resize",function(){if(!settings.isClosed){return}closeWithNoAnimation()});self.data("sidebar",settings);return self};$.fn.sidebar.version="3.3.2"})(jQuery); 2 | -------------------------------------------------------------------------------- /sentrygund/static/js/sentrygund/event_handlers.js: -------------------------------------------------------------------------------- 1 | current_alerts = { 2 | 3 | storage : {}, 4 | add : function(new_alert) { 5 | 6 | alert_id = new_alert['id']; 7 | 8 | console.log(alert_id); 9 | 10 | if (!(alert_id in this.storage) || this.storage[alert_id] === 0) { 11 | 12 | this.storage[alert_id] = 0; 13 | this.create_collapsible(new_alert); 14 | } 15 | this.storage[alert_id]++; 16 | console.log(this.storage[alert_id]); 17 | this.add_to_collapsible(new_alert); 18 | }, 19 | remove : function(a) { 20 | 21 | this.remove_from_collapsible(a); 22 | this.destroy_collapsible(a['id']); 23 | }, 24 | create_collapsible : function(a) { 25 | 26 | console.log('swag'); 27 | 28 | alert_id = a['id']; 29 | ssid = a['essid']; 30 | bssid = a['bssid']; 31 | channel = a['channel']; 32 | intent = a['intent']; 33 | 34 | $('#set').append('

'+bssid+' '+channel+' '+intent+'

').collapsibleset('refresh'); 35 | 36 | $('.'+alert_id+' p').append('
'); 37 | $('.'+alert_id+' .tablewrap').append('
'); 38 | $('.'+alert_id+' .overflower').append('
'); 39 | $('.'+alert_id+' form').append(''); 40 | $('.'+alert_id+' .tablespan').append('
'); 41 | $('.'+alert_id+' .tablespan table').append(''); 42 | $('.'+alert_id+' .tablespan table').append(''); 43 | $('.'+alert_id+' thead').append('Device'); 44 | $('.'+alert_id+' thead').append('Distance'); 45 | $('.'+alert_id+' thead').append('TX'); 46 | 47 | $('.'+alert_id+' form').append('
'); 48 | 49 | $('.'+alert_id+' fieldset').append(''); 50 | $('.'+alert_id+' fieldset').append(''); 51 | $('.'+alert_id+' fieldset').append(''); 52 | $('.'+alert_id+' fieldset').append(''); 53 | $('.'+alert_id+' fieldset').append(''); 54 | $('.'+alert_id+' fieldset').append(''); 55 | $('.'+alert_id+' fieldset').append(''); 56 | $('.'+alert_id+' fieldset').append(''); 57 | $('.'+alert_id+' fieldset').append(''); 58 | $('.'+alert_id+' form').trigger('create'); 59 | $('.'+alert_id+' form table').trigger('create'); 60 | }, 61 | destroy_collapsible : function(alert_id) { 62 | 63 | $('.'+alert_id).remove(); 64 | }, 65 | add_to_collapsible : function(a) { 66 | 67 | console.log('woah'); 68 | alert_id = a['id']; 69 | $('#'+alert_id).empty(); 70 | 71 | var sortable = []; 72 | for (var device in a['locations']) { 73 | 74 | sortable.push([device, a['locations'][device]]); 75 | } 76 | sortable.sort( 77 | 78 | function(a, b) { 79 | 80 | return b[1] - a[1]; 81 | } 82 | ) 83 | for (var i = 0, len = sortable.length; i < len; i++) { 84 | 85 | var next_row = sortable[i]; 86 | console.log('next row: '+next_row); 87 | console.log(i); 88 | console.log(len); 89 | $('#'+alert_id).append(''); 90 | $('#'+alert_id+' .tr'+i).append(''+next_row[0]+''); 91 | $('#'+alert_id+' .tr'+i).append(''+(1.0/Math.sqrt(256 + next_row[1]))+''); 92 | $('#'+alert_id+' .tr'+i).append(''+next_row[1]+''); 93 | 94 | } 95 | 96 | console.log(sortable); 97 | }, 98 | remove_from_collapsible : function(a) { 99 | 100 | var id = a['id']; 101 | 102 | $('#'+id).remove(); 103 | }, 104 | intent2description : function(intent) { 105 | 106 | return 'description goes here'; 107 | }, 108 | notify : function() { 109 | return; 110 | } 111 | } 112 | // EVENTS 113 | 114 | /* on_alert_add() 115 | * 116 | */ 117 | function on_alert_add(e) { 118 | 119 | current_alerts.add(e); 120 | } 121 | 122 | /* on_alert_dismiss() 123 | * 124 | */ 125 | function on_alert_dismiss(e) { 126 | 127 | console.log(e); 128 | for (var i = 0; i < e.length; i++) { 129 | current_alerts.remove(e[i]); 130 | } 131 | } 132 | 133 | /* on_connect() 134 | * 135 | */ 136 | function on_connect(e, socket) { 137 | 138 | socket.emit('connected'); 139 | } 140 | 141 | /* on_form_submit() 142 | * 143 | */ 144 | function on_form_submit(e) { 145 | 146 | e.preventDefault(); 147 | 148 | var checked = $(this).find('input[type=radio]:checked')[0]; 149 | switch (checked.value) { 150 | 151 | case 'choice-1': 152 | console.log('Locate'); 153 | break; 154 | case 'choice-2': 155 | console.log('Deauth'); 156 | deauth_targets(this); 157 | break; 158 | case 'choice-3': 159 | console.log('Napalm'); 160 | napalm_targets(this); 161 | break; 162 | case 'choice-4': 163 | console.log('Dismiss'); 164 | dismiss_alerts(this); 165 | break; 166 | default: 167 | console.log('Invalid choice'); 168 | } 169 | } 170 | 171 | // ACTIONS 172 | 173 | function get_all_alerts() { 174 | 175 | $.getJSON( "/webcli/connect", function( alerts ) { 176 | console.log('test'); 177 | 178 | for (var i = 0; i < alerts.length; i++) { 179 | 180 | current_alerts.add(alerts[i]); 181 | } 182 | 183 | }); 184 | } 185 | 186 | /* dismiss_alerts() 187 | * 188 | */ 189 | function dismiss_alerts(form) { 190 | 191 | 192 | console.log($(form)); 193 | var tbody = $(form).find('tbody'); 194 | console.log(tbody); 195 | var alert_location = tbody.attr('id'); 196 | console.log('send this: '+alert_location); 197 | 198 | alerts = []; 199 | alerts.push({ 'id' : alert_location }); 200 | $.ajax({ 201 | type: 'POST', 202 | url: 'alert/dismiss', 203 | data: JSON.stringify(alerts), 204 | success: function(data) { console.log(data); }, 205 | contentType: "application/json", 206 | dataType: 'json' 207 | }); 208 | } 209 | 210 | 211 | /* request_disconnect() 212 | * 213 | */ 214 | function request_disconnect(socket) { 215 | 216 | socket.emit('disconnect request'); 217 | } 218 | 219 | function napalm_targets(form) { 220 | 221 | 222 | console.log($(form)); 223 | var tbody = $(form).find('tbody'); 224 | var alert_location = tbody.attr('id'); 225 | var alerts = [ { 'id' : alert_location } ]; 226 | console.log('alert is: '+alerts); 227 | $.ajax({ 228 | type: 'POST', 229 | url: '/napalm', 230 | data: JSON.stringify(alerts), 231 | success: function(data) { console.log(data); }, 232 | contentType: "application/json", 233 | dataType: 'json' 234 | }); 235 | 236 | } 237 | 238 | function deauth_targets(form) { 239 | 240 | 241 | console.log($(form)); 242 | var tbody = $(form).find('tbody'); 243 | var alert_location = tbody.attr('id'); 244 | var alerts = [ { 'id' : alert_location } ]; 245 | console.log('alert is: '+alerts); 246 | $.ajax({ 247 | type: 'POST', 248 | url: '/deauth', 249 | data: JSON.stringify(alerts), 250 | success: function(data) { console.log(data); }, 251 | contentType: "application/json", 252 | dataType: 'json' 253 | }); 254 | 255 | } 256 | -------------------------------------------------------------------------------- /sentrygund/static/js/sentrygund/main.js: -------------------------------------------------------------------------------- 1 | protocol = 'http' 2 | 3 | $(document).ready(function() { 4 | 5 | // setup page ------------------------------------------------------------- 6 | get_all_alerts(); 7 | 8 | // setup socketio --------------------------------------------------------- 9 | 10 | namespace = '/watchdog' 11 | 12 | sock_uri = [protocol, 13 | '://', 14 | document.domain, 15 | ':', 16 | location.port, 17 | namespace].join(''); 18 | 19 | var socket = io.connect(sock_uri); 20 | 21 | // socketio events -------------------------------------------------------- 22 | 23 | socket.on('dismiss alerts', on_alert_dismiss); 24 | 25 | socket.on('add alert', on_alert_add); 26 | 27 | // dom events ------------------------------------------------------------- 28 | 29 | $('.nav-button').click(request_disconnect); 30 | 31 | $('.dismiss-button').click(dismiss_alerts); 32 | 33 | $(document).on('submit', 'form', on_form_submit); 34 | }); 35 | -------------------------------------------------------------------------------- /sentrygund/static/js/socket.io.min.js: -------------------------------------------------------------------------------- 1 | !function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.io=t()}}(function(){var t;return function e(t,n,r){function o(s,a){if(!n[s]){if(!t[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(i)return i(s,!0);throw new Error("Cannot find module '"+s+"'")}var p=n[s]={exports:{}};t[s][0].call(p.exports,function(e){var n=t[s][1][e];return o(n?n:e)},p,p.exports,e,t,n,r)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s0&&!this.encoding){var t=this.packetBuffer.shift();this.packet(t)}},n.prototype.cleanup=function(){for(var t;t=this.subs.shift();)t.destroy();this.packetBuffer=[],this.encoding=!1,this.decoder.destroy()},n.prototype.close=n.prototype.disconnect=function(){this.skipReconnect=!0,this.backoff.reset(),this.readyState="closed",this.engine&&this.engine.close()},n.prototype.onclose=function(t){p("close"),this.cleanup(),this.backoff.reset(),this.readyState="closed",this.emit("close",t),this._reconnection&&!this.skipReconnect&&this.reconnect()},n.prototype.reconnect=function(){if(this.reconnecting||this.skipReconnect)return this;var t=this;if(this.backoff.attempts>=this._reconnectionAttempts)p("reconnect failed"),this.backoff.reset(),this.emitAll("reconnect_failed"),this.reconnecting=!1;else{var e=this.backoff.duration();p("will wait %dms before reconnect attempt",e),this.reconnecting=!0;var n=setTimeout(function(){t.skipReconnect||(p("attempting reconnect"),t.emitAll("reconnect_attempt",t.backoff.attempts),t.emitAll("reconnecting",t.backoff.attempts),t.skipReconnect||t.open(function(e){e?(p("reconnect attempt error"),t.reconnecting=!1,t.reconnect(),t.emitAll("reconnect_error",e.data)):(p("reconnect success"),t.onreconnect())}))},e);this.subs.push({destroy:function(){clearTimeout(n)}})}},n.prototype.onreconnect=function(){var t=this.backoff.attempts;this.reconnecting=!1,this.backoff.reset(),this.updateSocketIds(),this.emitAll("reconnect",t)}},{"./on":4,"./socket":5,"./url":6,backo2:7,"component-bind":8,"component-emitter":9,debug:10,"engine.io-client":11,indexof:42,"object-component":43,"socket.io-parser":46}],4:[function(t,e){function n(t,e,n){return t.on(e,n),{destroy:function(){t.removeListener(e,n)}}}e.exports=n},{}],5:[function(t,e,n){function r(t,e){this.io=t,this.nsp=e,this.json=this,this.ids=0,this.acks={},this.io.autoConnect&&this.open(),this.receiveBuffer=[],this.sendBuffer=[],this.connected=!1,this.disconnected=!0}var o=t("socket.io-parser"),i=t("component-emitter"),s=t("to-array"),a=t("./on"),c=t("component-bind"),p=t("debug")("socket.io-client:socket"),u=t("has-binary");e.exports=n=r;var f={connect:1,connect_error:1,connect_timeout:1,disconnect:1,error:1,reconnect:1,reconnect_attempt:1,reconnect_failed:1,reconnect_error:1,reconnecting:1},h=i.prototype.emit;i(r.prototype),r.prototype.subEvents=function(){if(!this.subs){var t=this.io;this.subs=[a(t,"open",c(this,"onopen")),a(t,"packet",c(this,"onpacket")),a(t,"close",c(this,"onclose"))]}},r.prototype.open=r.prototype.connect=function(){return this.connected?this:(this.subEvents(),this.io.open(),"open"==this.io.readyState&&this.onopen(),this)},r.prototype.send=function(){var t=s(arguments);return t.unshift("message"),this.emit.apply(this,t),this},r.prototype.emit=function(t){if(f.hasOwnProperty(t))return h.apply(this,arguments),this;var e=s(arguments),n=o.EVENT;u(e)&&(n=o.BINARY_EVENT);var r={type:n,data:e};return"function"==typeof e[e.length-1]&&(p("emitting packet with ack id %d",this.ids),this.acks[this.ids]=e.pop(),r.id=this.ids++),this.connected?this.packet(r):this.sendBuffer.push(r),this},r.prototype.packet=function(t){t.nsp=this.nsp,this.io.packet(t)},r.prototype.onopen=function(){p("transport is open - connecting"),"/"!=this.nsp&&this.packet({type:o.CONNECT})},r.prototype.onclose=function(t){p("close (%s)",t),this.connected=!1,this.disconnected=!0,delete this.id,this.emit("disconnect",t)},r.prototype.onpacket=function(t){if(t.nsp==this.nsp)switch(t.type){case o.CONNECT:this.onconnect();break;case o.EVENT:this.onevent(t);break;case o.BINARY_EVENT:this.onevent(t);break;case o.ACK:this.onack(t);break;case o.BINARY_ACK:this.onack(t);break;case o.DISCONNECT:this.ondisconnect();break;case o.ERROR:this.emit("error",t.data)}},r.prototype.onevent=function(t){var e=t.data||[];p("emitting event %j",e),null!=t.id&&(p("attaching ack callback to event"),e.push(this.ack(t.id))),this.connected?h.apply(this,e):this.receiveBuffer.push(e)},r.prototype.ack=function(t){var e=this,n=!1;return function(){if(!n){n=!0;var r=s(arguments);p("sending ack %j",r);var i=u(r)?o.BINARY_ACK:o.ACK;e.packet({type:i,id:t,data:r})}}},r.prototype.onack=function(t){p("calling ack %s with %j",t.id,t.data);var e=this.acks[t.id];e.apply(this,t.data),delete this.acks[t.id]},r.prototype.onconnect=function(){this.connected=!0,this.disconnected=!1,this.emit("connect"),this.emitBuffered()},r.prototype.emitBuffered=function(){var t;for(t=0;t0&&t.jitter<=1?t.jitter:0,this.attempts=0}e.exports=n,n.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),n=Math.floor(e*this.jitter*t);t=0==(1&Math.floor(10*e))?t-n:t+n}return 0|Math.min(t,this.max)},n.prototype.reset=function(){this.attempts=0},n.prototype.setMin=function(t){this.ms=t},n.prototype.setMax=function(t){this.max=t},n.prototype.setJitter=function(t){this.jitter=t}},{}],8:[function(t,e){var n=[].slice;e.exports=function(t,e){if("string"==typeof e&&(e=t[e]),"function"!=typeof e)throw new Error("bind() requires a function");var r=n.call(arguments,2);return function(){return e.apply(t,r.concat(n.call(arguments)))}}},{}],9:[function(t,e){function n(t){return t?r(t):void 0}function r(t){for(var e in n.prototype)t[e]=n.prototype[e];return t}e.exports=n,n.prototype.on=n.prototype.addEventListener=function(t,e){return this._callbacks=this._callbacks||{},(this._callbacks[t]=this._callbacks[t]||[]).push(e),this},n.prototype.once=function(t,e){function n(){r.off(t,n),e.apply(this,arguments)}var r=this;return this._callbacks=this._callbacks||{},n.fn=e,this.on(t,n),this},n.prototype.off=n.prototype.removeListener=n.prototype.removeAllListeners=n.prototype.removeEventListener=function(t,e){if(this._callbacks=this._callbacks||{},0==arguments.length)return this._callbacks={},this;var n=this._callbacks[t];if(!n)return this;if(1==arguments.length)return delete this._callbacks[t],this;for(var r,o=0;or;++r)n[r].apply(this,e)}return this},n.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks[t]||[]},n.prototype.hasListeners=function(t){return!!this.listeners(t).length}},{}],10:[function(t,e){function n(t){return n.enabled(t)?function(e){e=r(e);var o=new Date,i=o-(n[t]||o);n[t]=o,e=t+" "+e+" +"+n.humanize(i),window.console&&console.log&&Function.prototype.apply.call(console.log,console,arguments)}:function(){}}function r(t){return t instanceof Error?t.stack||t.message:t}e.exports=n,n.names=[],n.skips=[],n.enable=function(t){try{localStorage.debug=t}catch(e){}for(var r=(t||"").split(/[\s,]+/),o=r.length,i=0;o>i;i++)t=r[i].replace("*",".*?"),"-"===t[0]?n.skips.push(new RegExp("^"+t.substr(1)+"$")):n.names.push(new RegExp("^"+t+"$"))},n.disable=function(){n.enable("")},n.humanize=function(t){var e=1e3,n=6e4,r=60*n;return t>=r?(t/r).toFixed(1)+"h":t>=n?(t/n).toFixed(1)+"m":t>=e?(t/e|0)+"s":t+"ms"},n.enabled=function(t){for(var e=0,r=n.skips.length;r>e;e++)if(n.skips[e].test(t))return!1;for(var e=0,r=n.names.length;r>e;e++)if(n.names[e].test(t))return!0;return!1};try{window.localStorage&&n.enable(localStorage.debug)}catch(o){}},{}],11:[function(t,e){e.exports=t("./lib/")},{"./lib/":12}],12:[function(t,e){e.exports=t("./socket"),e.exports.parser=t("engine.io-parser")},{"./socket":13,"engine.io-parser":25}],13:[function(t,e){(function(n){function r(t,e){if(!(this instanceof r))return new r(t,e);if(e=e||{},t&&"object"==typeof t&&(e=t,t=null),t&&(t=u(t),e.host=t.host,e.secure="https"==t.protocol||"wss"==t.protocol,e.port=t.port,t.query&&(e.query=t.query)),this.secure=null!=e.secure?e.secure:n.location&&"https:"==location.protocol,e.host){var o=e.host.split(":");e.hostname=o.shift(),o.length?e.port=o.pop():e.port||(e.port=this.secure?"443":"80")}this.agent=e.agent||!1,this.hostname=e.hostname||(n.location?location.hostname:"localhost"),this.port=e.port||(n.location&&location.port?location.port:this.secure?443:80),this.query=e.query||{},"string"==typeof this.query&&(this.query=h.decode(this.query)),this.upgrade=!1!==e.upgrade,this.path=(e.path||"/engine.io").replace(/\/$/,"")+"/",this.forceJSONP=!!e.forceJSONP,this.jsonp=!1!==e.jsonp,this.forceBase64=!!e.forceBase64,this.enablesXDR=!!e.enablesXDR,this.timestampParam=e.timestampParam||"t",this.timestampRequests=e.timestampRequests,this.transports=e.transports||["polling","websocket"],this.readyState="",this.writeBuffer=[],this.callbackBuffer=[],this.policyPort=e.policyPort||843,this.rememberUpgrade=e.rememberUpgrade||!1,this.binaryType=null,this.onlyBinaryUpgrades=e.onlyBinaryUpgrades,this.pfx=e.pfx||null,this.key=e.key||null,this.passphrase=e.passphrase||null,this.cert=e.cert||null,this.ca=e.ca||null,this.ciphers=e.ciphers||null,this.rejectUnauthorized=e.rejectUnauthorized||null,this.open()}function o(t){var e={};for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e}var i=t("./transports"),s=t("component-emitter"),a=t("debug")("engine.io-client:socket"),c=t("indexof"),p=t("engine.io-parser"),u=t("parseuri"),f=t("parsejson"),h=t("parseqs");e.exports=r,r.priorWebsocketSuccess=!1,s(r.prototype),r.protocol=p.protocol,r.Socket=r,r.Transport=t("./transport"),r.transports=t("./transports"),r.parser=t("engine.io-parser"),r.prototype.createTransport=function(t){a('creating transport "%s"',t);var e=o(this.query);e.EIO=p.protocol,e.transport=t,this.id&&(e.sid=this.id);var n=new i[t]({agent:this.agent,hostname:this.hostname,port:this.port,secure:this.secure,path:this.path,query:e,forceJSONP:this.forceJSONP,jsonp:this.jsonp,forceBase64:this.forceBase64,enablesXDR:this.enablesXDR,timestampRequests:this.timestampRequests,timestampParam:this.timestampParam,policyPort:this.policyPort,socket:this,pfx:this.pfx,key:this.key,passphrase:this.passphrase,cert:this.cert,ca:this.ca,ciphers:this.ciphers,rejectUnauthorized:this.rejectUnauthorized});return n},r.prototype.open=function(){var t;if(this.rememberUpgrade&&r.priorWebsocketSuccess&&-1!=this.transports.indexOf("websocket"))t="websocket";else{if(0==this.transports.length){var e=this;return void setTimeout(function(){e.emit("error","No transports available")},0)}t=this.transports[0]}this.readyState="opening";var t;try{t=this.createTransport(t)}catch(n){return this.transports.shift(),void this.open()}t.open(),this.setTransport(t)},r.prototype.setTransport=function(t){a("setting transport %s",t.name);var e=this;this.transport&&(a("clearing existing transport %s",this.transport.name),this.transport.removeAllListeners()),this.transport=t,t.on("drain",function(){e.onDrain()}).on("packet",function(t){e.onPacket(t)}).on("error",function(t){e.onError(t)}).on("close",function(){e.onClose("transport close")})},r.prototype.probe=function(t){function e(){if(h.onlyBinaryUpgrades){var e=!this.supportsBinary&&h.transport.supportsBinary;f=f||e}f||(a('probe transport "%s" opened',t),u.send([{type:"ping",data:"probe"}]),u.once("packet",function(e){if(!f)if("pong"==e.type&&"probe"==e.data){if(a('probe transport "%s" pong',t),h.upgrading=!0,h.emit("upgrading",u),!u)return;r.priorWebsocketSuccess="websocket"==u.name,a('pausing current transport "%s"',h.transport.name),h.transport.pause(function(){f||"closed"!=h.readyState&&(a("changing transport and sending upgrade packet"),p(),h.setTransport(u),u.send([{type:"upgrade"}]),h.emit("upgrade",u),u=null,h.upgrading=!1,h.flush())})}else{a('probe transport "%s" failed',t);var n=new Error("probe error");n.transport=u.name,h.emit("upgradeError",n)}}))}function n(){f||(f=!0,p(),u.close(),u=null)}function o(e){var r=new Error("probe error: "+e);r.transport=u.name,n(),a('probe transport "%s" failed because of error: %s',t,e),h.emit("upgradeError",r)}function i(){o("transport closed")}function s(){o("socket closed")}function c(t){u&&t.name!=u.name&&(a('"%s" works - aborting "%s"',t.name,u.name),n())}function p(){u.removeListener("open",e),u.removeListener("error",o),u.removeListener("close",i),h.removeListener("close",s),h.removeListener("upgrading",c)}a('probing transport "%s"',t);var u=this.createTransport(t,{probe:1}),f=!1,h=this;r.priorWebsocketSuccess=!1,u.once("open",e),u.once("error",o),u.once("close",i),this.once("close",s),this.once("upgrading",c),u.open()},r.prototype.onOpen=function(){if(a("socket open"),this.readyState="open",r.priorWebsocketSuccess="websocket"==this.transport.name,this.emit("open"),this.flush(),"open"==this.readyState&&this.upgrade&&this.transport.pause){a("starting upgrade probes");for(var t=0,e=this.upgrades.length;e>t;t++)this.probe(this.upgrades[t])}},r.prototype.onPacket=function(t){if("opening"==this.readyState||"open"==this.readyState)switch(a('socket receive: type "%s", data "%s"',t.type,t.data),this.emit("packet",t),this.emit("heartbeat"),t.type){case"open":this.onHandshake(f(t.data));break;case"pong":this.setPing();break;case"error":var e=new Error("server error");e.code=t.data,this.emit("error",e);break;case"message":this.emit("data",t.data),this.emit("message",t.data)}else a('packet received with socket readyState "%s"',this.readyState)},r.prototype.onHandshake=function(t){this.emit("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this.upgrades=this.filterUpgrades(t.upgrades),this.pingInterval=t.pingInterval,this.pingTimeout=t.pingTimeout,this.onOpen(),"closed"!=this.readyState&&(this.setPing(),this.removeListener("heartbeat",this.onHeartbeat),this.on("heartbeat",this.onHeartbeat))},r.prototype.onHeartbeat=function(t){clearTimeout(this.pingTimeoutTimer);var e=this;e.pingTimeoutTimer=setTimeout(function(){"closed"!=e.readyState&&e.onClose("ping timeout")},t||e.pingInterval+e.pingTimeout)},r.prototype.setPing=function(){var t=this;clearTimeout(t.pingIntervalTimer),t.pingIntervalTimer=setTimeout(function(){a("writing ping packet - expecting pong within %sms",t.pingTimeout),t.ping(),t.onHeartbeat(t.pingTimeout)},t.pingInterval)},r.prototype.ping=function(){this.sendPacket("ping")},r.prototype.onDrain=function(){for(var t=0;tn;n++)~c(this.transports,t[n])&&e.push(t[n]);return e}}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./transport":14,"./transports":15,"component-emitter":9,debug:22,"engine.io-parser":25,indexof:42,parsejson:34,parseqs:35,parseuri:36}],14:[function(t,e){function n(t){this.path=t.path,this.hostname=t.hostname,this.port=t.port,this.secure=t.secure,this.query=t.query,this.timestampParam=t.timestampParam,this.timestampRequests=t.timestampRequests,this.readyState="",this.agent=t.agent||!1,this.socket=t.socket,this.enablesXDR=t.enablesXDR,this.pfx=t.pfx,this.key=t.key,this.passphrase=t.passphrase,this.cert=t.cert,this.ca=t.ca,this.ciphers=t.ciphers,this.rejectUnauthorized=t.rejectUnauthorized}var r=t("engine.io-parser"),o=t("component-emitter");e.exports=n,o(n.prototype),n.timestamps=0,n.prototype.onError=function(t,e){var n=new Error(t);return n.type="TransportError",n.description=e,this.emit("error",n),this},n.prototype.open=function(){return("closed"==this.readyState||""==this.readyState)&&(this.readyState="opening",this.doOpen()),this},n.prototype.close=function(){return("opening"==this.readyState||"open"==this.readyState)&&(this.doClose(),this.onClose()),this},n.prototype.send=function(t){if("open"!=this.readyState)throw new Error("Transport not open");this.write(t)},n.prototype.onOpen=function(){this.readyState="open",this.writable=!0,this.emit("open")},n.prototype.onData=function(t){var e=r.decodePacket(t,this.socket.binaryType);this.onPacket(e)},n.prototype.onPacket=function(t){this.emit("packet",t)},n.prototype.onClose=function(){this.readyState="closed",this.emit("close")}},{"component-emitter":9,"engine.io-parser":25}],15:[function(t,e,n){(function(e){function r(t){var n,r=!1,a=!1,c=!1!==t.jsonp;if(e.location){var p="https:"==location.protocol,u=location.port;u||(u=p?443:80),r=t.hostname!=location.hostname||u!=t.port,a=t.secure!=p}if(t.xdomain=r,t.xscheme=a,n=new o(t),"open"in n&&!t.forceJSONP)return new i(t);if(!c)throw new Error("JSONP disabled");return new s(t)}var o=t("xmlhttprequest"),i=t("./polling-xhr"),s=t("./polling-jsonp"),a=t("./websocket");n.polling=r,n.websocket=a}).call(this,"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./polling-jsonp":16,"./polling-xhr":17,"./websocket":19,xmlhttprequest:20}],16:[function(t,e){(function(n){function r(){}function o(t){i.call(this,t),this.query=this.query||{},a||(n.___eio||(n.___eio=[]),a=n.___eio),this.index=a.length;var e=this;a.push(function(t){e.onData(t)}),this.query.j=this.index,n.document&&n.addEventListener&&n.addEventListener("beforeunload",function(){e.script&&(e.script.onerror=r)},!1)}var i=t("./polling"),s=t("component-inherit");e.exports=o;var a,c=/\n/g,p=/\\n/g;s(o,i),o.prototype.supportsBinary=!1,o.prototype.doClose=function(){this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),this.form&&(this.form.parentNode.removeChild(this.form),this.form=null,this.iframe=null),i.prototype.doClose.call(this)},o.prototype.doPoll=function(){var t=this,e=document.createElement("script");this.script&&(this.script.parentNode.removeChild(this.script),this.script=null),e.async=!0,e.src=this.uri(),e.onerror=function(e){t.onError("jsonp poll error",e)};var n=document.getElementsByTagName("script")[0];n.parentNode.insertBefore(e,n),this.script=e;var r="undefined"!=typeof navigator&&/gecko/i.test(navigator.userAgent);r&&setTimeout(function(){var t=document.createElement("iframe");document.body.appendChild(t),document.body.removeChild(t)},100)},o.prototype.doWrite=function(t,e){function n(){r(),e()}function r(){if(o.iframe)try{o.form.removeChild(o.iframe)}catch(t){o.onError("jsonp polling iframe removal error",t)}try{var e='