Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function hexToRgb(hex) { | |
| r = hex.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i); | |
| if (r) { | |
| return r.slice(1, 4).map(function(x) { | |
| return parseInt(x, 16); | |
| }); | |
| } | |
| return null; | |
| } |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //double quotes test | |
| val pattern = """(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})\s*(-)\s*(-)\s*(\[.+?\])\s*"(.+?)\s(.+?)\s(.+?)"\s*(\d{1,3})\s*(\d{1,10})\s*"(.+?)"\s*"(.+?)"\s*"(.+?)"""".r; | |
| val input = """174.371.196.220 - - [07/Sep/2017:00:06:00 +0000] "GET /cs/v1/points/bal?memberId=2164699082&accountType=10 HTTP/1.1" 200 4263 "-" "Mozilla/5.0 (Windows NT 6.0; rv:34.0) Gecko/20100101 Firefox/34.0" "-""""; | |
| val res = input match { | |
| case pattern(ip, username1, logname2, time, requestType, requestURL, requestMethod, status, bytes, referer, userAgent, filename ) => s"IP=$ip\nUsername=$username1\nLogname=$logname2\nTime=$time\nRequestType=$requestType\nRequestURL=$requestURL\nRequestMethod=$requestMethod\nStatus=$status\nBytes=$bytes\nReferer=$referer\nUserAgent=$userAgent\nFilename=$filename" | |
| case _ => "NONE" | |
| } | |
| print(res) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from random import * | |
| import string | |
| min = 10 | |
| max = 20 | |
| combination = string.ascii_letters + string.digits + string.punctuation | |
| var_pass = "".join(choice(combination) for x in range(randint(min, max))) | |
| print("Random Password String: ", var_pass) |
NewerOlder