Deny write to Everyone blocking also read access (icacls) - security

I'm trying to deny only write access to some folders using:
icacls "C:\Temp\otentu\*" /deny Everyone:(OI)(CI)(W)
In effect I can't also open subfolders. When I doing this same via UI I can open them.
So after running this command when I go "Permissions" screen and just uncheck/check Deny Write and click OK I can open this folder and list items. There is no differences in checked items on "Advanced permissions" tab after this action.
C:\Temp\otentu\ is main folder with 2 subfolders, and we have two stories here:
Using UI I'm addig Deny Write to Everyone for one subfolder.
I'm calling above icacls.
Screenshot is showing that result of both of them is this same for this folder - other settings are untouched. After 1 I can open subfolder, after 2 I can't.
Can someone help what I missing here?
EDIT:
I run icacls "C:\Temp\otentu" /T /C /L /Q for each scenario - no difference at all. To simplify I left only one subfolder.
BEFORE:
C:\Temp\otentu BUILTIN\Administrators:(I)(OI)(CI)(F)
NT AUTHORITY\SYSTEM:(I)(OI)(CI)(F)
BUILTIN\Users:(I)(OI)(CI)(RX)
NT AUTHORITY\Authenticated Users:(I)(M)
NT AUTHORITY\Authenticated Users:(I)(OI)(CI)(IO)(M)
C:\Temp\otentu\dwa BUILTIN\Administrators:(I)(OI)(CI)(F)
NT AUTHORITY\SYSTEM:(I)(OI)(CI)(F)
BUILTIN\Users:(I)(OI)(CI)(RX)
NT AUTHORITY\Authenticated Users:(I)(M)
NT AUTHORITY\Authenticated Users:(I)(OI)(CI)(IO)(M)
AFTER UI CHANGES:
C:\Temp\otentu BUILTIN\Administrators:(I)(OI)(CI)(F)
NT AUTHORITY\SYSTEM:(I)(OI)(CI)(F)
BUILTIN\Users:(I)(OI)(CI)(RX)
NT AUTHORITY\Authenticated Users:(I)(M)
NT AUTHORITY\Authenticated Users:(I)(OI)(CI)(IO)(M)
C:\Temp\otentu\dwa Everyone:(OI)(CI)(DENY)(W)
BUILTIN\Administrators:(I)(OI)(CI)(F)
NT AUTHORITY\SYSTEM:(I)(OI)(CI)(F)
BUILTIN\Users:(I)(OI)(CI)(RX)
NT AUTHORITY\Authenticated Users:(I)(M)
NT AUTHORITY\Authenticated Users:(I)(OI)(CI)(IO)(M)
AFTER CMD:
C:\Temp\otentu BUILTIN\Administrators:(I)(OI)(CI)(F)
NT AUTHORITY\SYSTEM:(I)(OI)(CI)(F)
BUILTIN\Users:(I)(OI)(CI)(RX)
NT AUTHORITY\Authenticated Users:(I)(M)
NT AUTHORITY\Authenticated Users:(I)(OI)(CI)(IO)(M)
C:\Temp\otentu\dwa Everyone:(OI)(CI)(DENY)(W)
BUILTIN\Administrators:(I)(OI)(CI)(F)
NT AUTHORITY\SYSTEM:(I)(OI)(CI)(F)
BUILTIN\Users:(I)(OI)(CI)(RX)
NT AUTHORITY\Authenticated Users:(I)(M)
NT AUTHORITY\Authenticated Users:(I)(OI)(CI)(IO)(M)

Related

How do I find the XPATH of a certain element from a headless browser?

I'm accessing Google images with a headless linux chromeDriver browser. Here are my headers:
`
headers = ({'User-Agent':
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit\
/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'})
`
I'm downloading an image from an XPATH. My script works fine on my desktop. But as I cronjob this script from a linux server with a headless Linux chromeDriver browser, it's downloading an image from a different XPATH.
The problem is that I can't manually see which XPATH the script is downloading whilst on the Linux server.
However, I'm certain this is a "browser" problem because I understand that XPATHs are different between browsers. Are my headers (above) telling my script to use Firefox? Am I actually using Chrome?
On my desktop, I'm running Chrome 108 on macOS (Big Sur) and my script works fine.
Tried:
# Finding 2nd image
small_image = browser.find_element('xpath',"//*[#id='islrg']/div[1]/div[2]")
print("Clicking...")
small_image.click()
time.sleep(2)
# Expanding image to full resolution
big_image = browser.find_element('xpath',"//*[#id='Sva75c']/div[2]/div/div[2]/div[2]/div[2]/c-wiz/div[2]/div[1]/div[1]/div[2]/div/a/img")
time.sleep(5)
# Download image
imageURL= big_image.get_attribute('src')
Actual result:
got attribute('src) of SMALL_IMAGE instead of BIG_IMAGE, from what I can see.

Pycharm selenium how to open actual webbroswer window (LINUX)

APOLOGISE FOR FIRST POST, I AM NEW TO STACK OVERFLOW...GREATLY APPRECICIATE THE HELP...
I can get it to run without opening the actual window, I want to see the actual page it opens though...
I have..
-Imported os
-Made sure webdriver is up to date and matches current version
-is on path..(absolute and relative, even put driver in the same file
tried Chrome and Firefox
checked chown is me and is executable
-it will open from separate terminal instance when I type chromedriver.
-'which chromedriver' shows /usr/bin/chromedriver (and I used that as path.
I have a very new linux system running Ubuntu (POPos)
ALL UPDATED AND UPGRADED.
I don't know what is wrong...
from selenium import webdriver
import os
import time
options = webdriver.ChromeOptions()
options.add_argument('--headless') # Remove this if you want a selenium controlled browser window
options.add_argument('--ignore-certificate-errors')
user_agent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.88 Safari/537.36'
options.add_argument('user-agent={0}'.format(user_agent))
preferences = {
"profile.default_content_settings.popups": 0,
"download.default_directory": os.getcwd() + os.path.sep,
"directory_upgrade": True
} # My own set of preferences, use what you want
options.add_experimental_option('prefs', preferences)
driver = webdriver.Chrome("/home/wprice/PycharmProjects/sele/chromedriver-Linux64", options=options) # Since I am using Windows
driver.get("HTTPS://GOOGLE.COM")
time.sleep(20)
driver.save_screenshot("test.png")
ERRORS:
/home/wprice/PycharmProjects/sele/bin/python /home/wprice/PycharmProjects/sele/sele.py
Traceback (most recent call last):
File "/home/wprice/PycharmProjects/sele/sele.py", line 18, in <module>
driver = webdriver.Chrome("/home/wprice/PycharmProjects/sele/chromedriver-Linux64", options=options) # Since I am using Windows
File "/home/wprice/PycharmProjects/sele/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py", line 73, in __init__
self.service.start()
File "/home/wprice/PycharmProjects/sele/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 98, in start
self.assert_process_still_running()
File "/home/wprice/PycharmProjects/sele/lib/python3.8/site-packages/selenium/webdriver/common/service.py", line 109, in assert_process_still_running
raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: Service /home/wprice/PycharmProjects/sele/chromedriver-Linux64 unexpectedly exited. Status code was: 127
We don't have your code / stack trace, so I am guessing it's probably one of the following issues I can think of at the moment::
Your editor is unable to find the correct web driver path
Your Chrome web driver version doesn't match with the installed chrome version
Error in initializing the web drivers
So, based on that you can try this code, just replace the variables with the right values and it should probably work
options = webdriver.ChromeOptions()
options.add_argument('--headless') # Remove this if you want a selenium controlled browser window
options.add_argument('--ignore-certificate-errors')
user_agent = 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36'
options.add_argument('user-agent={0}'.format(user_agent))
preferences = {
"profile.default_content_settings.popups": 0,
"download.default_directory": os.getcwd() + os.path.sep,
"directory_upgrade": True
} # My own set of preferences, use what you want
options.add_experimental_option('prefs', preferences)
driver = webdriver.Chrome("CHROMEDRIVER.EXE_ABSOLUTE_PATH", options=options) # Since I am using Windows
driver.get("WEBSITE_TO_SCRAPE")
time.sleep(20)
driver.save_screenshot("test.png")

Azure AD "groups" claim not being passed to mod_auth_openidc

I created an Azure AD account to test SSO. I was able to get Apache to authenticate a site using SSO and pass the authenticated user's email address as a header. I'm having trouble getting the "groups" claim to be passed through.
My Apache config looks as follows:
LoadModule auth_openidc_module /usr/lib64/httpd/modules/mod_auth_openidc.so
<IfModule mod_auth_openidc.c>
OIDCProviderMetadataURL https://sts.windows.net/<removed>/.well-known/openid-configuration
OIDCClientID <removed>
OIDCClientSecret <removed>
OIDCRedirectURI https://<removed>/redirect_uri
OIDCResponseType code
OIDCScope "openid email profile groups family_name given_name"
OIDCSSLValidateServer Off
OIDCCryptoPassphrase <removed>
OIDCPassClaimsAs headers
OIDCClaimPrefix USERINFO_
OIDCRemoteUserClaim email
OIDCPassUserInfoAs claims
OIDCAuthNHeader USER
OIDCPassIDTokenAs claims
OIDCPassRefreshToken On
</IfModule>
My Optional claims in Azure AD looks like this:
Additionally I created a group in AD called "Users" and added myself to that group. So I would expect to see "Users" passed as some sort of attribute in the headers.
If I print the HTTP headers on the server I see this...
CONTEXT_DOCUMENT_ROOT: /var/httpd/cgi-bin/
CONTEXT_PREFIX: /cgi-bin/
DOCUMENT_ROOT: /var/SP/httpd/htdocs/docs
GATEWAY_INTERFACE: CGI/1.1
HTTP_ACCEPT: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
HTTP_ACCEPT_ENCODING: gzip, deflate, br
HTTP_ACCEPT_LANGUAGE: en-GB,en-US;q=0.9,en;q=0.8
HTTP_CACHE_CONTROL: max-age=0
HTTP_COOKIE: _ga=GA1.2.601634409.1596125029; mod_auth_openidc_session=c186c9d6-eebe-11ea-8429-7982f43b32a7
HTTP_HOST: <removed>
HTTP_SEC_FETCH_DEST: document
HTTP_SEC_FETCH_MODE: navigate
HTTP_SEC_FETCH_SITE: none
HTTP_SEC_FETCH_USER: ?1
HTTP_UPGRADE_INSECURE_REQUESTS: 1
HTTP_USER: <removed>
HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/84.0.4147.135 Safari/537.36
HTTP_X_AMZN_TRACE_ID: Root=1-5f52559a-6b8b464ec338a6097565fce0
HTTP_X_FORWARDED_FOR: <removed>
HTTP_X_FORWARDED_PORT: 443
HTTP_X_FORWARDED_PROTO: https
LD_LIBRARY_PATH: /opt/apache-2.4/lib64
PATH: /sbin:/usr/sbin:/bin:/usr/bin
QUERY_STRING:
REMOTE_ADDR: <removed>
REMOTE_PORT: 45364
REMOTE_USER: <removed>
REQUEST_METHOD: GET
REQUEST_SCHEME: http
REQUEST_URI: /cgi-bin/headers.cgi
SCRIPT_FILENAME: /var/httpd/cgi-bin/headers.cgi
SCRIPT_NAME: /cgi-bin/headers.cgi
SCRIPT_URI: http://<removed>/cgi-bin/headers.cgi
SCRIPT_URL: /cgi-bin/headers.cgi
SERVER_ADDR: <removed>
SERVER_ADMIN: <removed>
SERVER_NAME: <removed>
SERVER_PORT: 80
SERVER_PROTOCOL: HTTP/1.1
SERVER_SIGNATURE:
SERVER_SOFTWARE: Apache/2.4.46 (Unix) OpenSSL/1.1.1c
X_REMOTE_USER: <removed>
The REMOTE_USER, X_REMOTE_USER and HTTP_USER all show the correct authenticated user email.
I don't see anything related to "groups", "USERINFO_", "family_name", "given_name". Not even blank placeholders.
I'm a bit stuck as the Apache config looks okay as far as I can tell and from what I have read the Azure configuration is okay as well.
Any ideas why the claims are not being passed through?
I changed:
OIDCPassClaimsAs headers
to:
OIDCPassClaimsAs both
... and it worked!

I installed requests but still got import requests ImportError: No module named requests python

I'm following this tutorial for web scraping and tried to run it as test initially but always get this error message on VS Code even though I've installed the latest Python version 3.8.1 along with requests module, this's the error message below
This's the tutorial link and you can pause at 5:07 to see him running and testing the code normally without any errors.
https://www.youtube.com/watch?v=Bg9r_yLk7VY&t=241s
And this's my code so far running on Mac OS
import requests
from bs4 import BeautifulSoup
URL = 'https://www.amazon.com/-/de/dp/B07RF1XD36/ref=lp_16225007011_1_6?s=computers-intl-ship&ie=UTF8&qid=1581249551&sr=1-6'
headers ={"User-Agent": 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36'}
page = requests.get(URL, headers=headers)
soup = BeautifulSoup(page.content, 'html.parser')
print(soup.prettify())
print('Hello')

How to make Logstash parse newly added/logged content to a file input in a real-time way

I am reading the Processing Apache Logs example in the Logstash Configuration Examples section of the Logstash Reference [1.5]. One of the sentences goes:
"Any additional lines logged to this file will also be captured,
processed by Logstash as events, and stored in Elasticsearch."
I am trying to implement it by adding one more line to the log file being monitored while the Logstash shutdown has NOT completed. And that is basically what I meant by "real-time" in the question title.
Below is how I actually tried it:
Step 1. Pass in logstash-apache.conf to Logstash
The version of the Logstash I'm using is 1.5.4. And the code for logstash-apache.conf is:
input {
file {
path => "/your/path/to/the/log/file"
start_position => "beginning"
type => "apache_access"
}
}
filter {
if [path] =~ "access" {
grok {
match => { "message" => "%{COMBINEDAPACHELOG}" }
}
}
date {
match => ["timestamp", "dd/MMM/yyyy:HH:mm:ss Z"]
}
}
output {
elasticsearch {
host => localhost
protocol => "http"
port => "9200"
}
stdout { codec => rubydebug }
}
The conf file is almost the same as the example. However, the type of "apache_access" is added to the file input plugin instead of being put in the mutate filter plugin, per reading the explanation on the site. Please replace the path within the file input plugin with yours.
For your convenience, the sample log is provided here:
71.141.244.242 - kurt [18/May/2011:01:48:10 -0700] "GET /admin HTTP/1.1" 301 566 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3"
134.39.72.245 - - [18/May/2011:12:40:18 -0700] "GET /favicon.ico HTTP/1.1" 200 1189 "-" "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.2; .NET4.0C; .NET4.0E)"
98.83.179.51 - - [18/May/2011:19:35:08 -0700] "GET /css/main.css HTTP/1.1" 200 1837 "http://www.safesand.com/information.htm" "Mozilla/5.0 (Windows NT 6.0; WOW64; rv:2.0.1) Gecko/20100101 Firefox/4.0.1"
After Logstash's processing, the standard out has 3 results in the rubydebug format, which can be seen in the uploaded image (of course, these 3 are also indexed in Elasticsearch):
Image of 3 results appearing in the standard out in the rubydebug format after Logstash's processing
Please be noted that the pipeline generated by the conf file has not been shutdown at this point.
Step 2. Add one more line of log to the file using the text editor in the server and save the change
This is the line I add, which should be the 4th line in the log file:
71.141.244.242 - kurt [18/May/2011:01:48:10 -0700] "GET /admin HTTP/1.1" 301 566 "-" "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3"
After doing this, I expected to have one more result showing in the standard out because I believe the file input plugin can be configured to do so as the file input plugin section in the same reference says:
The plugin aims to track changing files and emit new content as it’s
appended to each file.
Unfortunately, nothing happened.
Am I on the wrong track, and doing the whole thing wrong? If not, could anyone here help me achieve what I intend to do, and possibly explain the mechanism behind it? Any help will be greatly appreciated.

Resources