SSL Certs acceptance using AutoIT - google-chrome

Is it possible to accept SSL Certificates in Chrome/Firefox using AutoIT tool?
https://www.autoitscript.com/site/autoit/
Thanks!

The short answer is yes. You have 3 options depending on what you want to do. They are:
Use the FF.au3 and the Chrome.au3 UDFs plus other AutoIt automations. (Hard)
Use iUIAutomation plus other AutoIt automations. (A little less hard)
If you just need to get some certificate info you can use this script. (pretty easy)
If you go with option 3 you will need to download this UDF and update the WinINetConstants.Au3 file on line 5 from:
Global Const $AU3_UNICODE = Number($AU3_VERSION[2] & "." & $AU3_VERSION[3]) >= 2.13 Or #AutoItUnicode
To
Global Const $AU3_UNICODE = Number($AU3_VERSION[2] & "." & $AU3_VERSION[3]) >= 2.13 Or #AutoItVersion

Related

Snort configuration dead end

I'm in a dead end at the configuration of snort.
In theory a simple problem.
I created a test rule to check if snort runs properly.
Location:\etc\snort\rules\local.rules
Content:
alert icmp any any -> $HOME_NET any (msg:"ICMP on fire"; sid:10000001; rev:001;)
Then I ran on terminal :
sudo snort -T -i enp0s3 -c /etc/snort/snort.conf
Message I receive at the end of the initialization:
"Snort successfully validated the configuration!"
"Snort exiting"
But scrolling up I'm seeing:
Initializing rule chains...
0 Snort rules read
0 detection rules
0 decoder rules
0 preprocessor rules
0 Option Chains linked into 0 Chain Headers
No rules at all!
location is correct in conf file under
/etc/snort/snort.conf
var RULE_PATH /etc/snort/rules
Snort 2.9.17 Build 199
Ubuntu 20.04
Any ideas?Thnnks in advance!
I would recommend supplying the rule path when you execute Snort using the "--rule-path" flag.
The --rule-path flag is not available and not recognized.
As far I understand this variable is just that, a variable that's not used anywhere in the configuration file.
The only way/workaround that I found was include the rule files for ex.
In the snort.conf appending this.
.
.
.
.
include c:\local.rules
Besides that, someone found a way to match content in answer/response?
I mean, let suppose that I want to check if the server has answer with a known content, for ex: success. I've tried with bidirectional operator <> and flow:to_client but nothing has worked.

How to validate mysql database URI

I'm trying to integrate a Gem named blazer with my Rails application and I have to specify mysql database URL in blazer.yml file so that it can access data in staging and production environments.
I believe the standard format to define MySQL database URL is
mysql2://user:password#hostname:3306/database
I defined my URL in the same format as a string and when I validate the URI I get the below error
URI::InvalidURIError: bad URI(is not URI?):
mysql2://f77_oe_85_staging:LcCh%264855c6M;kG9yGhjghjZC?JquGVK#factory97-aurora-staging-cluster.cluster-cmj77682fpy4kjl.us-east-1.rds.amazonaws.com/factory97_oe85_staging
Defined Mysql database URL:
'mysql2://f77_oe_85_staging:LcCh%264855c6M;kG9yGhjghjZC?JquGVK#factory97-aurora-staging-cluster.cluster-cmj77682fpy4kjl.us-east-1.rds.amazonaws.com/factory97_oe85_staging'
Please advice
The URI is invalid.
The problem is the password contains characters which are not valid in a URI. The username:password is the userinfo part of a URI. From RFC 3986...
foo://example.com:8042/over/there?name=ferret#nose
\_/ \______________/\_________/ \_________/ \__/
| | | | |
scheme authority path query fragment
authority = [ userinfo "#" ] host [ ":" port ]
userinfo = *( unreserved / pct-encoded / sub-delims / ":" )
pct-encoded = "%" HEXDIG HEXDIG
unreserved = ALPHA / DIGIT / "-" / "." / "_" / "~"
sub-delims = "!" / "$" / "&" / "'" / "(" / ")"
/ "*" / "+" / "," / ";" / "="
Specifically it's the ? in the password LcCh%264855c6M;kG9yGhjghjZC?JquGVK. It looks like the password is only partially escaped.
I think a problem is the issue is not well isolated. Here is an example strategy of how to isolate it.
The error code of URI::InvalidURIError: bad URI(is not URI?): only indicates the library (blazer gem) successfully read a file, which may or may not be the file you have edited, /YOUR_DIR/blazer.yml or something, but nevertheless failed to parse the URI.
Now, the issues to consider include:
blazer gem really read /YOUR_DIR/blazer.yml?
does the preprocessor of the yml work as expected?
is the uri key specified correct?
mysql: or mysql2?
are the formats of IP, port, account name, password, and database name all correct? In particular, are special characters correctly escaped? (See MySql document about special characters)
I suppose the OP knows answers of some of these questions but we don't. So, let's assume any of them can be an issue.
Then a proposed strategy is this:
Find a URI that is at least in a correct format and confirm it is parsed and recognised correctly by Gem blazer. Note you only need to test the format and so dummy parameters are fine. For example, try a combination of the following and see which does not issue the error URI::InvalidURIError:
mysql://127.0.0.1/test
mysql://adam:alphabetonly#127.0.0.1/test
jdbc:mysql://adam:alphabetonly#127.0.0.1/test
Now, you know at least the potential issues (1),(3),(4) are irrelevant.
Replace the IP (hostname), account name, password, and database name one by one with the real one and find which raises the error URI::InvalidURIError. Now you have narrowed down which part causes a problem. In the OP's case, I suspect the problem is an incorrect escape of the special characters in the password part. Let's assume that is the case, and then,
properly escape the part so that they form a correct URI format as a whole. The answer by #Schwern is a good summary about the format. As a tip, you can get an escape URI by opening Rail's console (via rails c) and typing URI.encode('YOUR_PASSWORD') or alternatively, run ruby directly from the command-line in a (UNIX-shell) terminal:
ruby -ruri -e "puts URI.encode('YOUR_PASSWORD')"
Replace the password part in the URI in /YOUR_DIR/blazer.yml with the escaped string, and confirm it does not issue the error URI::InvalidURIError (hopefully).
In these processing, I deliberately avoided the preprocessor part, (2).
This answer to "Rails not parsing database URL on production" mentions about URI.encode('YOUR_PASSWORD') in a yml file, but it implicitly assumes a preprocessor works fine. During the test phase, that just adds another layer of complication, and so it is better to skip it. If you need it in your production (to mask the password etc), implement it later, when you know everything else works fine.
Hope by the time the OP has tried all of these, the problem is solved.

Apache "server-status" (mod_status) output as in JSON or XML format?

Apache "mod_status":
We know, by using "mod_status", we can check Apache's current status. It returns a lot of information, something like in this sample page (provided by Apache):
https://www.apache.org/server-status
What i need to do:
I need to parse and then process this results, especially the detailed connections section given by ExtendedStatus flag (inside httpd.conf). The section looks something like:
Srv PID Acc M CPU SS Req Conn Child Slot Client VHost Request
0-24 23433 0/94/338163 _ 208.04 2 0 0.0 1.85 22068.75 221.254.46.37
0-24 23433 0/99/337929 _ 208.93 1 1141 0.0 2.23 19373.00 197.89.161.5
0-24 23433 0/94/337834 _ 206.04 4 0 0.0 3.46 22065.36 114.31.251.82
0-24 23433 0/95/338139 _ 198.94 2 7 0.0 2.74 21101.66 122.252.253.242
0-24 23433 0/111/338215 _ 206.21 3 0 0.0 3.89 19496.71 186.5.109.211
My Question:
Is it possible to get this page (information) via a structured data format, like JSON? (Because i need to parse them via PHP. And then do some further stuffs later.)
I cannot just use some easy ways, like Javascript DOM Parsers (like: jQuery). Because i need the script to be running in the Server's Linux Commandline (locally) itself. Not via any fancy client Browsers from outside.
So, parsing this via Javascript (JQuery, etc) is almost not a choice. I better receive a structured data. So i can parse from PHP way easily. Trigger the PHP Script via Terminal, like:
# php /www/docroots/parse-server-status.php
Or, at least:
# curl -I http://localhost/parse-server-status.php
Question:
Any idea how to get the JSON or XML out of Apache's Server Status (mod_status), please?
Thanks all.
I don't think there is a way to get json in the standard apache mod_status.
But there was a discussion on the developer list about this topic.
In short: There is an other script that you have to install on your server. And you need mod_lua on the server. Here is the project page:
https://github.com/Humbedooh/server-status
After installing that lua script, you could get the json files.
Daniel installed a sample script here:
HTML view: http://httpd.apache.org/server-status
JSON: http://httpd.apache.org/server-status?view=json
Extended JSON:
http://httpd.apache.org/server-status?view=json&extended=true (LOT OF
DATA :p)
In JavaScript/jQuery (ES6) we can get Apache machine readable status with ?auto and parse the content via Regular Expressions:
$.get('http://localhost/parse-server-status.php?auto', (d) => {
const o = {};
const host = d.substring(0, d.indexOf('\n'));
Array.from(d.replace(host, '').matchAll(/^([\w\s]+)\:\s(.*)+/gm)).forEach(l => o[l[1].replace(/\s/, '')] = l[2]);
console.log(host, o);
});

No auto-complete on HTML and CSS files in VIM (YouCompleteMe)

For some reason, I get no autocomplete on html and css files. All works well with other languages, for example JS, Ruby or Python.
I've spent close to 2h today trying to fix it but to no avail. I use Vundle and YouCompleteMe to do all of this. You can have a look at my .vimrc file here https://gist.github.com/comatory/73aacac1b0249b8c1c55.
I'm on OS X 10.10.5 and my Vim version is 7.4 (installed via Homebrew). I also use Macvim but it doesn't matter, it doesn't work in either of them.
Check the value of the paste setting
:verbose set paste?
will show you the current value for this buffer as well as which plugin set it last.
In my experience, completion doesn't happen if paste is set. Disable with
:set nopaste
Maybe it is in your filepath blacklist as in default.
Quote from: https://github.com/ycm-core/YouCompleteMe/
The g:ycm_filepath_blacklist option
This option controls for which Vim filetypes (see :h filetype) should filepath completion be disabled. The option value should be a Vim dictionary with keys being filetype strings (like python, cpp, etc.) and values being unimportant (the dictionary is used like a hash set, meaning that only the keys matter).
let g:ycm_filepath_blacklist = {'*': 1}
The * key is special and matches all filetypes. Use this key if you want to completely disable filepath completion:
You can get the filetype of the current file in Vim with :set ft?.
Default: [see next line]
let g:ycm_filepath_blacklist = {
\ 'html': 1,
\ 'jsx': 1,
\ 'xml': 1,
\}
I would suggest you use NeoComplete. I tried YouCompleteMe on Vim8, but doesn't work for some reason. NeoComplete does the job for me.
After installing NeoComplete just add, let g:neocomplete#enable_at_startup = 1 to your .vimrrc

Use LibreOffice to convert HTML to PDF from Mac command in terminal?

I'm trying to convert a HTML file to a PDF by using the Mac terminal.
I found a similar post and I did use the code they provided. But I kept getting nothing. I did not find the output file anywhere when I issued this command:
./soffice --headless --convert-to pdf --outdir /home/user ~/Downloads/*.odt
I'm using Mac OS X 10.8.5.
Can someone show me a terminal command line that I can use to convert HTML to PDF?
I'm trying to convert a HTML file to a PDF by using the Mac terminal.
Ok, here is an alternative way to do convert (X)HTML to PDF on a Mac command line. It does not use LibreOffice at all and should work on all Macs.
This method (ab)uses a filter from the Mac's print subsystem, called xhtmltopdf. This filter is usually not meant to be used by end-users but only by the CUPS printing system.
However, if you know about it, know where to find it and know how to run it, there is no problem with doing so:
The first thing to know is that it is not in any desktop user's $PATH. It is in /usr/libexec/cups/filter/xhtmltopdf.
The second thing to know is that it requires a specific syntax and order of parameters to run, otherwise it won't. Calling it with no parameters at all (or with the wrong number of parameters) it will emit a small usage hint:
$ /usr/libexec/cups/filter/xhtmltopdf
Usage: xhtmltopdf job-id user title copies options [file]
Most of these parameter names show that the tool clearly related to printing. The command requires in total at least 5, or an optional 6th parameter. If only 5 parameters are given, it reads its input from <stdin>, otherwise from the 6ths parameter, a file name. It always emits its output to <stdout>.
The only CLI params which are interesting to us are number 5 (the "options") and the (optional) number 6 (the input file name).
When we run it on the command line, we have to supply 5 dummy or empty parameters first, before we can put the input file's name. We also have to redirect the output to a PDF file.
So, let's try it:
/usr/libexec/cups/filter/xhtmltopdf "" "" "" "" "" my.html > my.pdf
Or, alternatively (this is faster to type and easier to check for completeness, using 5 dummy parameters instead of 5 empty ones):
/usr/libexec/cups/filter/xhtmltopdf 1 2 3 4 5 my.html > my.pdf
While we are at it, we could try to apply some other CUPS print subsystem filters on the output: /usr/libexec/cups/filter/cgpdftopdf looks like one that could be interesting. This additional filter expects the same sort of parameter number and orders, like all CUPS filters.
So this should work:
/usr/libexec/cups/filter/xhtmltopdf 1 2 3 4 5 my.html \
| /usr/libexec/cups/filter/cgpdftopdf 1 2 3 4 "" \
> my.pdf
However, piping the output of xhtmltopdf into cgpdftopdf is only interesting if we try to apply some "print options". That is, we need to come up with some settings in parameter no. 5 which achieve something.
Looking up the CUPS command line options on the CUPS web page suggests a few candidates:
-o number-up=4
-o page-border=double-thick
-o number-up-layout=tblr
do look like they could be applied while doing a PDF-to-PDF transformation. Let's try:
/usr/libexec/cups/filter/xhtmltopdfcc 1 2 3 4 5 my.html \
| /usr/libexec/cups/filter/cgpdftopdf 1 2 3 4 5 \
"number-up=4 page-border=double-thick number-up-layout=tblr" \
> my.pdf
Here are two screenshots of results I achieved with this method. Both used as input files two HTML files which were identical, apart from one line: it was the line which referenced a CSS file to be used for rendering the HTML.
As you can see, the xhtmltopdf filter is able to (at least partially) take into account CSS settings when it converts its input to PDF:
Starting 3.6.0.1 , you would need unoconv on the system to converts documents.
Using unoconv with MacOS X
LibreOffice 3.6.0.1 or later is required to use unoconv under MacOS X. This is the first version distributed with an internal python script that works. No version of OpenOffice for MacOS X (3.4 is the current version) works because the necessary internal files are not included inside the application.
I just had the same problem, but I found this LibreOffice help post. It seems that headless mode won't work if you've got LibreOffice (the usual GUI version) running too. The fix is to add an -env option, e.g.
libreoffice "-env:UserInstallation=file:///tmp/LibO_Conversion" \
--headless \
--invisible \
--convert-to csv file.xls