How to serialize cookies from net/http cookiejar?

I want to get all cookies from my cookiejar to serialize them for later usage after state loss (e.g. program restart). My service goes through roughly 30 different urls and stores about 1-5 cookies per url. I've looked around and stumbled upon this open issue.

Based on that, I can't seem to find an idiomatic way of serializing/deserializing cookies from a cookiejar, and I find that very strange. What is your prefered way of accessing all cookies from the jar? Am I missing something? The only solution I can see is to manually read the request.Cookies() and store them in a map[url.URL]*http.Cookie - which seems redundant.

Edit (8/13/2018): It seems like the most 'idiomatic' option right now is to fork the http/net cookiejar and extend the functionality, e.g. something like the JuJu persistent cookiejar

👍︎ 2
📰︎ r/golang
💬︎
👤︎ u/mobilesin
📅︎ Aug 12 2018
🚨︎ report
Error returned when decrypting Chrome encryption key

I have a number of SharePoint lists that house data that I use for various reports. Previously I've used Microsoft Power Automate to create a csv of each list as I've found connecting directly to lists and files in SharePoint is often slooooooow when doing so from PBI or PQ. I was using the Shareplum to get the list data (and some file data) and this was working great up until a week or so ago. The only "big" change since then was Chrome updated to version 90. However, I can't find ANY documentation on Chrome updating how their cookies are encrypted or how their encryption key works. The error also leads me to believe the issue is with win32crypt and not Chrome? But researching that hasn't been fruitful.

Here is the code:

import os
import json
import base64
import sqlite3
import shutil
from datetime import datetime, timedelta
from win32 import win32crypt
from Crypto.Cipher import AES
import getpass
from requests_ntlm import HttpNtlmAuth
from shareplum import Site
from shareplum import Office365
from shareplum.site import Version
import csv
import http.cookiejar
import pandas as pd
import numpy as np

def get_chrome_datetime(chromedate):
    """Return a `datetime.datetime` object from a chrome format datetime
    Since `chromedate` is formatted as the number of microseconds since January, 1601"""
    if chromedate != 86400000000 and chromedate:
        try:
            return datetime(1601, 1, 1) + timedelta(microseconds=chromedate)
        except Exception as e:
            print(f"Error: {e}, chromedate: {chromedate}")
            return chromedate
    else:
        return ""

def get_encryption_key():
    path = r'%LocalAppData%\Google\Chrome\user Data\Local State'
    path = os.path.expandvars(path)

    with open(path, "r", encoding="utf-8") as f:
        key = json.loads(f.read())['os_crypt']['encrypted_key']
    # decode the encryption key from Base64
    key = base64.b64decode(key)
    # remove 'DPAPI' str
    key = key[5:]
    # return decrypted key that was originally encrypted
    # using a session key derived from current user's logon credentials
    return win32crypt.CryptUnprotectData(key, None, None, None, 0)[1]

def decrypt_data(data, key):
    try:
        # get the initialization vector
        iv = data[3:15]
        data = data[15:]
... keep reading on reddit ➡

👍︎ 2
💬︎
📅︎ Apr 27 2021
🚨︎ report
Persisting cookies after application exits?

I have a program that uses an http.Client with a standard cookie jar from the net/http/cookiejar package. The API I'm consuming gives a couple of cookies at login that, when consumed by a browser, allow the user to remain logged in even after closing and reopening the browser.

Annoyingly, http.Cookie doesn't seem to have JSON struct tags, so my naive initial solution was to make my own struct with the same fields, copy each cookie and store it as JSON, then read the cookies back and set them on the client at launch to prevent having to send login requests every time it starts. But when I do this, I get missing fields in the stored JSON (domain is missing from all of them).

I'm curious what solutions you have used to tackle this problem.

👍︎ 2
📰︎ r/golang
💬︎
📅︎ Apr 08 2020
🚨︎ report
Need help with youtube dl and cookies.

So I'm trying to download some videos from pornhub premium, but I can't. Could someone lend me a hand?

First of all, I use the cookie extension to get the file cookies.txt

Then I type "cd C:\Users\Me\Downloads" and it works fine

But then I type "youtube-dl --cookies E:\Downloads\cookies.txt VIDEOLINK" I get the following text in CMD:

C:\Users\Me\Downloads\youtube-dl.exe\http\cookiejar.py:2059: UserWarning: http.cookiejar bug!
Traceback (most recent call last):
  File "C:\Python\Python34\lib\http\cookiejar.py", line 2021, in _really_load
ValueError: too many values to unpack (expected 7)

Traceback (most recent call last):
  File "C:\Python\Python34\lib\http\cookiejar.py", line 2021, in _really_load
ValueError: too many values to unpack (expected 7)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "__main__.py", line 19, in <module>
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmp378onz6j\build\youtube_dl\__init__.py", line 474, in main
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmp378onz6j\build\youtube_dl\__init__.py", line 441, in _real_main
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmp378onz6j\build\youtube_dl\YoutubeDL.py", line 419, in __init__
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmp378onz6j\build\youtube_dl\YoutubeDL.py", line 2329, in _setup_opener
  File "C:\Users\dst\AppData\Roaming\Build archive\youtube-dl\ytdl-org\tmp378onz6j\build\youtube_dl\utils.py", line 2762, in load
  File "C:\Python\Python34\lib\http\cookiejar.py", line 2061, in _really_load
http.cookiejar.LoadError: invalid Netscape format cookies file 'E:\\Downloads\\cookies.txt': 'www.lancebradfordphotography.com\tFALSE\t/\tFALSE\t1582279159\tssr-caching\t"cache,desc=miss,varnish=miss,\tdc,desc=84"'

I don't know anything about programming, could someone tell me the exact command I have to use?

I am using windows and I have python and FFmpeg installed in my PC.

👍︎ 6
📰︎ r/youtubedl
💬︎
📅︎ Mar 13 2020
🚨︎ report
Automated Login for Screen Scraper?

So I've just written my first screen scraper using BeautifulSoup and I'm pretty happy that I got it working. Now, I need to scrape a page that requires a login and have no clue how to go about doing that. I attempted to use a StackOverflow solution with CookieJar, but kept running into some issues with it. I easy_install'd "http" because apparently http.cookiejar doesn't exist in the modules directory and now when I attempt to "import http.cookiejar" or "import cookiejar" it says it doesn't exist.

Any help with fixing CookieJar or using a different module to automate the login would be greatly appreciated.

👍︎ 2
📰︎ r/Python
💬︎
📅︎ Dec 16 2016
🚨︎ report
Multi threading help

Hey guys. A noob here. So I was working on a reddit bot. I am not using praw because I want to work in a bigger scope. So far I have worked most of the bot out. I am using urlli, http.cookiejar and json modules. I cannot buy reddit gold due to third world reasons and am stuck with like 100 comments per second. Which is ludicrous. I have been looking into threading in python with little to no avail.

So the thing is, My bot is constantly scouring the comments for a keyword. And when the keyword is found, I must start a function. I want to start the function in a different thread whilst my first thread continues looking. When the keyword is triggered again, I need to start a new thread again. The new threads must close automatically when the function completes the run.

So: for item in items: if item["data"]["body"] == "keyword": comment(item)

I want this comment function to start in a new thread and my main thread to continue.

Anyone here could point me in the right direction?

👍︎ 3
💬︎
📅︎ May 16 2017
🚨︎ report
Can't sort this one out: trying to log in using PRAW, keep getting "AttributeError: 'MockRequest' object has no attribute 'origin_req_host'"

I'm just beginning to learn how to use PRAW and python, so this may be something very obvious that I'm missing, but I keep getting this when I try to log in using PRAW:

C:\Python33\lib\http\client.py:1172: DeprecationWarning: the 'strict' argument isn't supported anymore; http.client now always assumes HTTP/1.x compliant servers.
  source_address)
Traceback (most recent call last):
  File "C:\Python33\Files\Test5.py", line 11, in <module>
    r.login(USERNAME,PASSWORD) # necessary if your bot will talk to people
  File "C:\Python33\lib\site-packages\praw\__init__.py", line 1120, in login
    self.request_json(self.config['login'], data=data)
  File "C:\Python33\lib\site-packages\praw\decorators.py", line 95, in wrapped
    return_value = function(reddit_session, *args, **kwargs)
  File "C:\Python33\lib\site-packages\praw\__init__.py", line 469, in request_json
    response = self._request(url, params, data)
  File "C:\Python33\lib\site-packages\praw\__init__.py", line 342, in _request
    response = handle_redirect()
  File "C:\Python33\lib\site-packages\praw\__init__.py", line 315, in handle_redirect
    timeout=timeout, **kwargs)
  File "C:\Python33\lib\site-packages\praw\handlers.py", line 135, in wrapped
    result = function(cls, **kwargs)
  File "C:\Python33\lib\site-packages\praw\handlers.py", line 54, in wrapped
    return function(cls, **kwargs)
  File "C:\Python33\lib\site-packages\praw\handlers.py", line 90, in request
    allow_redirects=False)
  File "C:\Python33\lib\site-packages\requests\sessions.py", line 460, in send
    r = adapter.send(request, **kwargs)
  File "C:\Python33\lib\site-packages\requests\adapters.py", line 256, in send
    r = self.build_response(request, resp)
  File "C:\Python33\lib\site-packages\requests\adapters.py", line 125, in build_response
    extract_cookies_to_jar(response.cookies, req, resp)
  File "C:\Python33\lib\site-packages\requests\cookies.py", line 105, in     extract_cookies_to_jar
    jar.extract_cookies(res, req)
  File "C:\Python33\lib\http\cookiejar.py", line 1647, in extract_cookies
    if self._policy.set_ok(cookie, request):
  File "C:\Python33\lib\http\cookiejar.py", line 931, in set_ok
    if not fn(cookie, request):
  File "C:\Python33\lib\http\cookiejar.py", line 952, in set_ok_verifiability
    if request.unverifiable and is_third_party(request):
... keep reading on reddit ➡

👍︎ 5
📰︎ r/redditdev
💬︎
📅︎ May 20 2013
🚨︎ report
Script Search and Print Url result Help

Hey,

So for some context. I'm trying to work on a side project to take a .txt / string list of names and use a script to search the file and print the top url result from say a google / bing search. I'm running into a bit of a roadblock with the script I'm trying to reconstruct and I wanted to see if anyone has experience with a project like this and could recommend some guidance. I'm relatively new to python and picking it up as I go along with projects so again appreciate any suggestions or guidance.

I want to understand how I can import my list into this and parse it.

Here's what I'm working with so far:

#!/usr/bin/env python

# Python bindings to the Google search engine
# Copyright (c) 2009-2014, Mario Vilas
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
#     * Redistributions of source code must retain the above copyright notice,
#       this list of conditions and the following disclaimer.
#     * Redistributions in binary form must reproduce the above copyright
#       notice,this list of conditions and the following disclaimer in the
#       documentation and/or other materials provided with the distribution.
#     * Neither the name of the copyright holder nor the names of its
#       contributors may be used to endorse or promote products derived from
#       this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

__all__ = ['search']

import os
import sys
import time

if sys.version_info[0] > 2:
    from http
... keep reading on reddit ➡

👍︎ 3
💬︎
📅︎ Mar 05 2017
🚨︎ report
about cookies,headers,something already drive me mad

here is the code:python2: import cookielib, urllib2

cj = cookielib.CookieJar() opener = urllib2.build_opener(urllib2.HTTPCookieProcessor(cj))

home = opener.open('http://hd.chinatax.gov.cn/guoshui/main.jsp') print home.headers print cj

output: Date: Mon, 16 Jan 2017 07:29:16 GMT Content-Length: 10798 Content-Type: text/html; charset=utf-8 csrftoken: fgk Cache-Control : No-cache Expires : Thu, 01 Jan 1970 00:00:00 GMT X-Powered-By: Servlet/2.5 JSP/2.1 Pragma : No-cache Set-Cookie: JSESSIONID=DQCmLhkRaWdjgw9A_a-vfLjGKTeOReQPsK1HNYQ6sIZsITQ4gCna!771370000; path=/; HttpOnly Set-Cookie: csrftoken=fgk; expires=Mon, 16-Jan-2017 07:34:16 GMT Set-Cookie: taxCode=localtax Set-Cookie: qd80-cookie=qdyy35-80; Expires=Tue, 17-Jan-2017 15:41:45 GMT Via: 1.1 ID-0314217205453516 uproxy-2 Connection: close

<cookielib.CookieJar[<Cookie JSESSIONID=DQCmLhkRaWdjgw9A_a-vfLjGKTeOReQPsK1HNYQ6sIZsITQ4gCna!771370000 for hd.chinatax.gov.cn/>, <Cookie qd80-cookie=qdyy35-80 for hd.chinatax.gov.cn/guoshui>, <Cookie taxCode=localtax for hd.chinatax.gov.cn/guoshui>]>

yes,everything is perfect

but,when I use python3,here is the code: import http.cookiejar, urllib.request

cj = http.cookiejar.CookieJar() opener = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj))

r = opener.open("http://hd.chinatax.gov.cn/guoshui/main.jsp") print(r.headers)

print(cj)

and the output: Date: Mon, 16 Jan 2017 07:46:22 GMT Content-Length: 10798 Content-Type: text/html; charset=utf-8 csrftoken: fgk

Cache-Control : No-cache Expires : Thu, 01 Jan 1970 00:00:00 GMT X-Powered-By: Servlet/2.5 JSP/2.1 Pragma : No-cache Set-Cookie: JSESSIONID=EsGmPcG5pN92wp8plRJcYIzbDgnZ824KGwH4XSkDGJwTqqgNzA23!30365037; path=/; HttpOnly Set-Cookie: csrftoken=fgk; expires=Mon, 16-Jan-2017 07:51:22 GMT Set-Cookie: taxCode=localtax Set-Cookie: qd80-cookie=qdyy32-80; Expires=Tue, 17-Jan-2017 16:02:16 GMT Via: 1.1 ID-0314217205453516 uproxy-5 Connection: close

<CookieJar[]> you see,the cookie jar is empty.but the headers do have cookies,but there are an empty line between them,so the cookiejar is empty.

well,I use requests to test the problem. the same code blow both run under python2 and 3: import requests

r = requests.get('http://hd.chinatax.gov.cn/guoshui/main.jsp') print(r.headers)

and the output are different. under python2: {'Cache-Control ': 'No-cache', 'Content-Length': '10798', 'Via': '1.1 ID-0314217205453516 uproxy-6', 'X-Powered-By': 'Servlet/2.5 JSP/2.1', 'Set-Cookie

... keep reading on reddit ➡

👍︎ 6
💬︎
👤︎ u/limw
📅︎ Jan 16 2017
🚨︎ report
Web automation with cookie handling in 3.3?

I was working on a project that automatically navigates a website filling out forms, and realized I needed cookie handling. I tried to download cookielib, only to find out it got changed to http.cookiejar, and i'm not really sure how this works. Not only that, but I realized my whole project was still running under python 2.7, and I tried to upgrade things but apparently cookiejar (not sure about mechanize, which is also what I was using) isn't compatible with 3.3. Is there an alternative cookie handling module that I can use with python 3.3?

👍︎ 3
📰︎ r/Python
💬︎
👤︎ u/aaka3207
📅︎ May 20 2015
🚨︎ report
Help with Facebook and Python...

So I want to make a script that will delete all my activity on my Facebook on account that is over a month old. Sadly, whenever I try to load a page, it says the "browser" isn't accepting cookies, even though I'm using http.cookiejar. Here's what I have so far (Python 3):

from http.cookiejar import *
from urllib.request import *
from urllib.parse import *

data = urlencode({'email':'[email protected]', 'pass':'password'})
data = data.encode('utf-8')
req = Request('https://www.facebook.com/login.php')
req.add_header("Content-Type","application/x-www-form-urlencoded;charset=utf-8")
#Tried to make it very realistic
req.add_header("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.75 Safari/537.1")
cj = CookieJar()
opener = build_opener(HTTPCookieProcessor(cj))
f = opener.open(req, data)
print(f.read().decode('utf-8'))

Any ideas?

👍︎ 3
💬︎
👤︎ u/Puzzel
📅︎ Aug 10 2012
🚨︎ report
Cummy's source code
#!/usr/bin/env python3
# -*- coding: UTF-8 -*-

from sys import stdout, stdin
from urllib import request as urlrequest
from urllib import parse as urlparse
from urllib import error as urlerror
from http import cookiejar
from time import sleep
import json
import re

VERSION = '69.420'
APP_TITLE = 'Cummybot'
USER_AGENT = {'User-agent': APP_TITLE + '/' + VERSION}

def request_json(request):
    try:
        return json.loads(urlrequest.urlopen(request).read().decode('utf-8'))
    except (urlerror.URLError, KeyError, ValueError):
        return None

def unescape_entities(html):
    left_bracket = re.compile('&amp;lt;', re.IGNORECASE)
    right_bracket = re.compile('&amp;gt;', re.IGNORECASE)
    ampersand = re.compile('&amp;amp;', re.IGNORECASE)
    return ampersand.sub('&amp;', right_bracket.sub('&gt;', left_bracket.sub('&lt;', html)))

class Title:
    def set(self, title):
        self.title = title
        stdout.write('\x1b]2;' + title + '\x07')
    
    def get(self):
        return self.title

class RedditInvalidUsernamePasswordException(Exception):
    pass

class SubredditSubmissionsCopier:
    def __init__(self, options, submitted):
        self.options = options
        self.submitted = submitted
        self._maybe_down_message = 'Perhaps the connection was interupted or %s is down.' % self.options.site
        cookie_jar = cookiejar.FileCookieJar()
        urlrequest.install_opener(urlrequest.build_opener(urlrequest.HTTPCookieProcessor(cookie_jar)))
    
    def login(self):
        params = urlparse.urlencode({
            'user': self.options.username,
            'passwd': self.options.password
        })
        
        request = urlrequest.Request(self.options.login_url, params, USER_AGENT)
        
        if self.options.verbose:
            print('Logging in as %s.' % self.options.username)
        
        response = request_json(request)
        
        if response is None or 'invalid password' in str(response):
            raise RedditInvalidUsernamePasswordException('Login failed. Please ensure that your username and password are correct.')
        
        title.set('%s - %s' % (self.options.target, APP_TITLE))
    
    def submit(self, submission, modhash):
        sel
... keep reading on reddit ➡

👍︎ 11k
📰︎ r/copypasta
💬︎
👤︎ u/SynthGood
📅︎ Oct 02 2020
🚨︎ report
cookietemple - a Python package providing programming project templates for several languages (Python, Java, C++, [...]) with extensive Github support, bump-version, a custom linter and much more

Github: https://github.com/cookiejar/cookietemple

Hi everyone,

One of the most annoying things when starting new projects is copying the skeleton of an old project and adapting it for the new project. Github templates and cookiecutter aimed at solving this problem by allowing for the quick generation of (customized) project templates. However, they suffer from several major shortcomings:

  1. They do not share a common structure. Even two Python templates may strongly differ in their architecture and design. Most templates are very basic and unfinished.

  2. They rarely ship with documentation setups, makefiles, issue templates, extensive continuous integration pipelines and many more best practices

  3. No one ensures that these templates adhere to best practices and nothing ensures that any templates updates are applied to already existing projects.

  4. It is annoying to bump the version across several configuration files.

cookietemple offers powerful project templates for several domains (e.g. command line tools or libraries) for several languages (Python, C++, Java, [...]), which can be created interactively with user choices (cookietemple create). Although, these templates do of course differ due to the different ecosystems, they share common structures and quality solving issue 1 and 2. The created project can be automatically pushed to a fresh Github repository. Whenever cookietemple updates a project template, a pull request is automatically submitted against the repository with the latest changes (cookietemple sync) and a custom linter ensures that the project always adheres to cookietemple’s high standards (cookietemple lint). This solves issue 3. cookietemple bump-version bumps the version across several configurable files and inserts new changelog sections allowing for regular releases. Please take a look at our website, documentation and repository and try out cookietemple.

cookietemple is free software licensed under Apache 2.0 and was developed in 2020 by us, a scientist’s and a medical doctor’s first major open-source project. We love the community and want to give back. cookietemple aims to be a community driven project and we would like to invite you to join us and to contribute new templates (e.g. Rust, C#, …), features, bug reports and fixes.

Cheers

👍︎ 63
📰︎ r/Python
💬︎
👤︎ u/Zethsc2
📅︎ Nov 24 2020
🚨︎ report
The End of the Journey to Red Velvet’s Discography (Part 15: ReVe Festival Finale)

Emphasis on the “Finale” part lol. And now we’re closing this Festival (and review) off with the grand Finale. There are only four new tracks on this repackage album, but each of them has its own charm.

Psycho - Oh yes, the song that got me into Red Velvet. When I first heard the song I absolutely fell in love with it. I knew Red Velvet were known for their vocals, but I didn’t know their vocals were that amazing. Irene with the Ariana Grande ponytail automatically made her my bias even though I didn’t know much about her lol. After the first listening, I go back into paying attention to all the details in the song. Of course, the synths in the chorus, the orchestral sound when Seulgi’s prechorus comes up, the little “bubble-sound” that’s in the second chorus. Saying that I love it is an understatement. I may talk about how I’m late to Red Velvet, but I’m glad Psycho was my first introduction to them. I know I’m sounding bias as hell right now, but shit...how can I not put this at number one? 10/10

In & Out - While Psycho was my first Red Velvet title track to listen to, In & Out was my first listen of their b-side. I didn’t know what to expect, but I know that the song impressed me way more than it did. The chorus made the song complete, and it does give me that “sweet bakery” feel, with an R&B sound to it. 10/10.

Remember Forever - One word: magical. Don’t you just wanna grab a cup of hot chocolate and look out the window when it’s snowing? Well, I live in the south of the USA so with that, I can’t live out that dream. The Christmas spirit of the song makes me feel all warm and soft. I know I would hardly listen to this song, and I need to be in the right Christmas mood for it, but that doesn’t stop it from being good. 8/10

La Rouge - Who do I have to sacrifice to get a music video for this song?! La Rouge is the jazz track of the album, and you know how Red Velvet doesn’t miss with it. Now admittedly, I wasn’t the big fan of this song when I first listened to it. I mean I didn’t hate it, but I didn’t go out of my way to listen to it. Now, after the second and onward listen, I warmed up to this song. One thing I can say is that I love artists who drag their voices in their songs, it’s so addicting! I like to think this track is Be Natural’s younger sister who is a lot more flashier lol. 9/10

The final song ranking is:

  1. Psycho - 10
  2. Parade - 10
  3. Body Talk - 10
  4. Dumb Dumb - 10
  5. Pee
... keep reading on reddit ➡

👍︎ 53
💬︎
📅︎ Oct 20 2020
🚨︎ report
PVWA and NGINX loadbalancer issue

Hello guys,

This will be quite long post but I'm trying to provide as much information as I can.

I have an issue with PVWA loadbalancing using NGINX servers. I do have following setup: DNS pointing at F5 LB, two NGINXes (one per DC) and then the traffic is balanced between target PVWA servers (maybe attached picture will tell you more than this description).

I am able to connect and establish a session via PVWA GUI (MFA, Internal, PKI authentication logon method) but I’m unable to perform REST calls. The situation is following – I’m using e.g. NGINX#1 as BaseURL, I’m able to get token, but then each subsequent call is failing with the message:

>"No session instance was found for this token"

To give you better insight:

Logon phase:

https://NGINX#1/PasswordVault/WebServices/auth/Cyberark/CyberArkAuthenticationService.svc/Logon
200
5.89 s
Warning: Unable to verify the first certificate
POST /PasswordVault/WebServices/auth/Cyberark/CyberArkAuthenticationService.svc/Logon HTTP/1.1
Content-Type: application/json
User-Agent: PostmanRuntime/7.26.8
Accept: */*
Cache-Control: no-cache
Postman-Token: 5d08918c-4ecd-421d-9d4f-0157ee7b69e4
Host: NGINX#1
Accept-Encoding: gzip, deflate, br
Connection: keep-alive
Content-Length: 84
{
"username": "User",
"password": "Password",
"connectionNumber": "1"
}
HTTP/1.1 200 OK
Date: Tue, 01 Dec 2020 11:49:07 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 206
Connection: keep-alive
Set-Cookie: W-SESSION-ID=dKDNbDY9bn2z84GN2fbO1r5vVAtG2ZhKmt48IhG7YwWVa0fu1qjvvRJ8Aqj1TFmr; Secure; HttpOnly;
Set-Cookie: CA22222=; path=/PasswordVault/; secure; HttpOnly
Set-Cookie: CA11111=; path=/PasswordVault/; secure; HttpOnly
Set-Cookie: CA55555=; path=/PasswordVault/; secure
Set-Cookie: CA33333=; path=/PasswordVault/; secure; HttpOnly
Set-Cookie: mobileState=Desktop; path=/PasswordVault/; secure; HttpOnly
Set-Cookie: C-SESSION-ID=130080j-1hSvh9x3zpaZMKC8vfD5GG-r3FH0PvFePZ7uaMkEHH0c8gU00346A231D00ED6C3B7228B0A2; Secure; HttpOnly;
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: -1
X-FRAME-Options: SAMEORIGIN
Strict-Transport-Security: max-age=3159600;includeSubdomains;
Strict-Transport-Security: max-age=31536000; includeSubDomains
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-UA-Compatible: IE=EmulateIE8
Access-Co
... keep reading on reddit ➡

👍︎ 2
📰︎ r/CyberARk
💬︎
👤︎ u/vekh6
📅︎ Dec 01 2020
🚨︎ report
If you are looking for an easy way to start a new project, checkout Cookietemple!

Cookietemple (also found at https://cookietemple.com) is a really interesting and awesome FOSS project for generating project templates, for many languages and many types of projects, such as CLI, LIB or GUI projects, based on Cookiecutter.

After making my modern C++ template which you all were really supporting of and provided awesome feedback, I was asked if I would like to add it to Cookietemple. The rest is history and you can check it out there!

There are a lot, and I mean a lot of features that CT offers, such as automatically making a GitHub repo for you project, linting, easy project updates to match the latest available templates and more!

It is ran by two awesome lads, both students and contributing to the project along side them was honestly one, if not the best part of working on Cookietemple. If you want to contribute to it, please do, since there is much passion and care put into developing this awesome piece of software!

👍︎ 2
📰︎ r/cpp
💬︎
📅︎ Nov 23 2020
🚨︎ report
Finished 4x4x48, 12h of meditation and a Cookie Jar Android App

On Friday at 4pm I decided to start my 4x4x48 challenge. I've been meditating 2 hours every day for the last 20 months, so I decided to sneak in one hour of meditation for every run. That means that I'm not only running 12 times but I'm also meditating for 12 hours over the period of 48 hours. The inspiration came from some guy here that said every run must be below 28m and every run must be faster than the previous one.

Between my first and second run I thought about the Cookie Jar. I didn't have on yet. I'm not a paper guy. Already when I read the book, I very much liked the idea of a Cookie Jar. I'm a software engineer so the only logical conclusion was - I've got to built an app.

I started developing the Cookie Jar App between after run #2 and finished the app before run #9. It took me 7 hours & 15 minutes. (On Sunday I added the 'Edit' Button which took another hour). Happy to answer any questions regarding the development process.

A cookie consists of a mandatory date, a mandatory title, an optional longer text and an optional image (either from Camera or Gallery).

Features I might add - for which I don't have a need yet:

  • Multiple images per cookie
  • Cookie with Video support
  • Cookie with Voice recording
  • Calendar view that shows all cookies
  • Import / Export Feature (for now everything is stored locally on the device)
  • Reminder feature asking you every X week whether you've got any new cookies

Last but not least:

  • iOS Version

Happy to get some feedback. If you download the app - https://play.google.com/store/apps/details?id=com.vanniktech.cookiejar&hl=en - until 07/25/2020 @ 12:00am (UTC) you won't see any ads. Fun Fact: Google initially rejected the App for mentioning `#stayhard` & `#takesouls` in the Store Listing.

All in all, the entire weekend is one of my first cookies that I'll be tracking.

👍︎ 41
💬︎
👤︎ u/vanniktech
📅︎ Jul 20 2020
🚨︎ report
Downloading PNG from site seems blocked

For a site I need to download a image (png) from a site, the image is showing if a specific business (my friends) has a good creditscore.

Normally the image is shown on his website but to optimize PageSpeed I'd like to download the image via cron once a day and store it on the webserver.

All should seem easy-peasy but I get zero data back from their website - I assume the image is blocked by some sessionid or similar, but no matter what I try I still get false in the curl result.

Any advice would be very much appreciated :)

$cookieFile = "cookies.txt";
if(!file_exists($cookieFile)) {  $fh = fopen($cookieFile, "w");    fwrite($fh, "");    fclose($fh); }
$url = 'https://merit.soliditet.dk/merit/imageGenerator/display?lang=DK&amp;country=DK&amp;cId=JeF%2B9ujkCwRHWqmtQMe7mw%3D%3D&amp;cUid=OvmsPYVc20g%3D&amp;imgType=img_273_73_px';
var_dump(file_get_contents_curl($url));

function file_get_contents_curl($url) { 
global $cookieFile; 
$ch=curl_init($url); curl_setopt($ch, CURLOPT_REFERER, $url); 
curl_setopt($ch, CURLOPT_VERBOSE, true); 
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); 
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); 
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); 
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
curl_setopt($ch, CURLOPT_COOKIEFILE, $cookieFile); // Cookie aware curl_setopt($ch, CURLOPT_COOKIEJAR, $cookieFile); // Cookie aware
$data = curl_exec($ch); curl_close($ch);
return $data; 
}
👍︎ 3
📰︎ r/PHPhelp
💬︎
👤︎ u/marktp3
📅︎ Aug 25 2020
🚨︎ report
How to Accept Cookies with Requests Library?

So, I. Am. Stuck.

I want to use the requests library to get information from this site: https://vi.nl/.
When doing this the straightforward way with requests.get() it returns the contents of the page that turns up when the site asks you to accept cookies.

I am completely lost at how to get around this page and to the actual content.
All the answers provided on the internet, leave me stuck with the same result: no actual content.
By looking for an answer I get the feeling that I have to learn HTTP, understand CookieJars and what not to be able to do this. I hope that it is either much simpler than this or - plainly - not possible, because I am going crazy about this simple question.

Could somebody please guide me in the right direction?

👍︎ 3
💬︎
👤︎ u/Sbcertje1
📅︎ May 20 2020
🚨︎ report
Wget to POST Get Contents of URL

Is it possible to use this Terminal command

wget "http://IP:PORT/api/put?name=%22NAME%22&links=%5B%22LINK%22%5D" --load-cookies=./cookiejar.txt -q -O -

using Get Contents of URL?

👍︎ 2
📰︎ r/shortcuts
💬︎
👤︎ u/FS5001
📅︎ Jun 20 2020
🚨︎ report
Why CookieJar uses 'static lifetime on cookies?

I just don't understand why.

As I assume, cookies lives only during request handling (from parsing http headers until finishing sending http body). Why CookieJar uses `'static` attribute on definitely non-static data?

The other questions: Does it leak memory by making non-static data static? How it is making cookie data static?

The method that I am talking about is here.

👍︎ 4
📰︎ r/rust
💬︎
📅︎ Feb 17 2020
🚨︎ report
[US-WA][H] Artisans (KWK/KBK, GAF, Booper, many others) [W] Joyzebels, KWK/KBK, Colonels, others

Funny text dot cavepainting

timestamp: https://i.imgur.com/nGv2n2N.jpg

Trades only; nothing for sale.

Have:

Reddit Makes The Top Row A Header Oops
Dodgy Antler blank Sweet Tooth Lurv ETF OG Bomb King (topre) Wildstory Scorned Lola Blood Seal Mulder v3 Bone China Shishi Unknown Joyboy (1/5) Fetish Joyzebel
Artkey Wadu Voodoo Artkey Seti Saura KK Juicy Frank KK Watermelon v1 SK Baaphomet (unknown) KK Kikkoman ETF Sweetbread Shellthulu ETF TGID Shellthulu
Artkey Strawberry Voodoo Artkey Raspberry Voodoo Booper Kaleidoscope (Variant) Bruce, b-stock Bro Apparition v2 Alpha Neon Visor Keypora Alpha Nuka Splat Keypora Bludgeoned Grave Walker Janus Ritual Master Crystal Sh*t Watcher
KWK Ritual Red topre esc KWK Ritual Red topre fn KWK Asphyxiated Blue WARus II (mx) GAF "100% Authentic" FVCCBOI GAF Ronin Calzonin TP GAF Foned In TB Dolly v1 (MX) b-stock Booper black friday Amelia

Caveat: some of these are obviously harder trades than others. Not sure yet that I want to trade the WARus as it's a recent acquisition. Very likely only considering same-maker swaps for the KWK/KBK and GAF stuff unless it's a true grail (glistening pine colonel, OG colonel, absinthe hoot)

Want:

  • Remaining joyzebels from v-day sale: Secks and Violet, G-pool, Nocturnal Emissions, Missed Messages, Nightcrawler, Waterworks, Suckyoub1tch

  • Green KWK/KBK

  • GAF swaps -- either colorswaps or Garbo 2 (serikat! I don't even have serika, but too good)

  • Watchers: Phantom, Trick (lol), Retro, Totoro (lol)

  • Donatello ETF -- debating whether to go for this set or not, seems hard. Maybe higher filaments fug/blank. Maybe topernican. Maybe cookiejar. Probably not interested in ETF other than those.

  • The usual: hoots, multishot colonels (glistening pine! 2+ year hunt for this cap. tips appreciated), dolly v1s

  • Youngerberry orxplorer

  • Green TMO50 (lol)

  • Other interesting green/trans green caps I don't already have

I'll admit upfront I can be kind of hard to trade with -- pretty picky at this point in my collecting. But feel free to propose stuff, worst I'll do is say no unless you're an absolute smeghead about it.

👍︎ 3
📰︎ r/mechmarket
💬︎
👤︎ u/wilarseny
📅︎ Aug 02 2019
🚨︎ report
Journey to Red Velvet’s Discography (Part 13: ReVe Festival Day 1)

And now we’re onto the ReVe Festival, and we have Day 1. Can I just say that the ReVe Festival Trilogy is probably one of the best things to come out of 2019? I thought I was gonna post this review tomorrow, but I couldn’t really get enough sleep, so I thought, “Why not give this album a few listens?”

Zimzalabim - Literally, how can you get more polarizing than Rookie and Really Bad Boy? Only Red Velvet. But this song perfectly captures the rollercoaster theme this whole Trilogy puts off. And just like the aforementioned Rookie and RBB, I admittedly loved ZZB on the first listened lol. Dare I say it is also one of my favorite title tracks? And a little detail is the chimes in the bridge; it’s short, but effective. So yeah, I’m a ZZB apologist lol. 10/10

Sunny Side Up! - Oh yeah, the b-side that some people couldn’t get over that it wasn’t the title track lol. Now luckily for me, I love both tracks so I would’ve fine with either one. Sunny Side Up is very chill and summery, it’s no surprise people would lean towards more this song. And the styling? Amazing. The melody and harmonization is so hypnotic to me. The first time I heard it, I couldn’t get it out of my head while I was trying to sleep lol. 10/10

Milkshake - I didn’t mentioned it when I was reviewing Sunny Side Up, but it had a groove beat to it. Milkshake, I think it cranks up the groove a lot, and the chorus is more “out-there” than SSU. Can I just say that the rapline killed it the second verse? I love the “Shake~, shake~, shake~.” Overlapping the chanting, “Shake! Shake! Shake!” I thought that was cute lol. 9.5/10

Bing Bing - This whole song reminds me if Red Velvet made their own version of Mark Ronson/Bruno Mars’ Uptown Funk, this would be it. The chorus does give me a similar vibe to Zimzalabim as well, but has more guitars and groovy sound. 8.5/10

Parade - This...this has to be my absolute favorite Red Velvet song of all time. It’s like if Mr. E had a more energetic, younger sibling, this would be the result. It literally sounds like you’re in a parade! Many people said that Sunny Side Up could’ve been a great title track, but I think Parade would’ve been a great contender as well! This song is so chaotic, and I love it so very much! 10/10

LP - And to close off Day 1, we’re getting Red Velvet’s interpretation of elevator music. This song has a lot more jazz and R&B than I expected, and that’s always a welcoming surprise. Just like So Good

... keep reading on reddit ➡

👍︎ 36
💬︎
📅︎ Oct 17 2020
🚨︎ report
Journey to Red Velvet’s Discography (Part 11: Summer Magic)

Now, we’re onto Summer Magic. Other than Blue Lemonade and (of course) Power Up, I never seen anyone talk about this album, so obviously I was curious to see what this album had.

Power Up - You mean to tell me some people hated this song when it came out?! Tasteless hacks. But in all seriousness, this song is just so energetic, and it’s serotonin in a song. Sure, it’s not my top favorite title track from them, but the song still slaps! 9/10

With You - I love how the song gives you a tropical, kinda reggae sound. It really makes you imagine that you’re in a tropical paradise. Also, Seulgi and Wendy popping off with the ad-libs after the bridge was everything, we love to see it! 9/10

Mr. E - Well I thought the song overall was gonna give me Zoo vibes, but the chorus was such a change of pace. But the subtle, jungle sounds does reminds me of Zoo. Also, I didn’t catch on that Mr. E = Mystery lol. 9/10

Mosquito - This is a very welcoming surprise lol, I didn’t expect this song to have a bit more of a groove, kinda heavy bass and hip-hop sound. I was expecting some very sweet sounding track lol. I say my favorite part would be the build-up to the chorus, and of course the bridge. Oh and Yeri and Irene’s imitation of a mosquito, that was a nice detail. 10/10

Hit the Drum - If this song is not part of a Zumba class, I’m throwing hands! The more I listen to the song, the more it gives me a more energetic, party version of Happiness. And if you didn’t ascend to the heavens with Wendy’s 14 seconds high note, then what is wrong with you? 9.5/10

Blue Lemonade - Huh, for the most part, the last song on albums usually don’t get that much attention to other tracks, so I’m surprised at how many people talk about Blue Lemonade. I mean, the song is really good, don’t have much to say. It does give me the impression that this is what Red Dress would sound like if it had a bit more subdued and summer vibes. 8.5/10

The song ranking so far:

  1. Body Talk - 10
  2. Dumb Dumb - 10
  3. Peek-a-Boo - 10
  4. Cool Hot Sweet Love - 10
  5. CookieJar - 10
  6. Attaboy - 10
  7. Russian Roulette - 10
  8. Red Dress - 10
  9. Bad Boy - 10
  10. Kingdom Come - 10
  11. Red Flavor - 10
  12. Zoo - 10
  13. Automatic - 10
  14. Mosquito - 10
  15. Happily Ever After - 10
  16. Bad Dracula - 9.5
  17. Perfect 10 - 9.5
  18. My Second Date - 9.5
  19. Look - 9.5
  20. You Better Know - 9.5
  21. Light Me Up - 9.5
  22. Sayonara - 9.5
  23. Little Little - 9.5
  24. Oh Boy - 9.5 2
... keep reading on reddit ➡

👍︎ 40
💬︎
📅︎ Oct 15 2020
🚨︎ report
Journey to Red Velvet’s Discography (Part 14: ReVe Festival Day 2)

We’re now on Day 2 of the ReVe Festival, and while the title track and b-sides may not be as hectic as Day 1, it still doesn’t stop it from being enjoyable! Not me sounding like a damn event producer lol

Umpah Umpah - I feel like this is one of Red Velvet’s overlooked title tracks. I mean sure, they played it safe with this song, but that’s not a good excuse to sleep on it, people 😤. Red Velvet never disappoints with their summer songs, so it’s no surprised that I loved Umpah Umpah on first listen. It was actually in my top 5 title tracks from them. The hype may be died down for me, but the song is still really great and captures summer perfectly. 9/10

Carpool - So what I liked about Day 1 was the cohesiveness of the theme of the album. It seems that Carpool continues the summer vibes that Umpah Umpah have. This seems a more relaxing version of Umpah Umpah but only a little bit, it still manages that energetic sound it has. It does make me feel like I’m in a Disney Channel movie lol. 9.5/10

Love is the Way - Love is the Way is more doo-wop than the previous two tracks, and that’s always a nice touch. The highlights were Joy and Seulgi’s vocals, and the “Your lips say no, but my heart says yes.” I don’t know why, but that part is really catchy lol. 9/10

Jumpin’ - Again, just like Carpool, it does give me Disney Channel kind of sounds that takes me back. I don’t know the exact instrument in the background, I know it’s a brass one, but the occasional in and out of it is a nice, little detail I love. Also, I think Jumpin’ probably has one of my favorite bridges from Red Velvet, and the last part of the song completes it. 10/10

Ladies’ Night - With the city pop genre, this automatically reminds me of All Right. I like to think of it as a continuation of that song. And just like All Right, I like this track, but I’m sure my sibling would love it since she loves city pop. Also, Wendy with the high note...you would think I would get use to it, but nope! She always surprise me. 8.5/10

Eyes Locked, Hands Locked - Is it a really a Red Velvet album if it doesn’t have a track that has R&B in it? Admittedly, I listen to this song once before this review, so I didn’t think much of it. Because of that, I took it for granted, and I don’t even know why, this song slaps! Just like any last track on an album, it’s more chill and a perfect way to close off Day 2. With all the other tracks making me feel like I’m in a b

... keep reading on reddit ➡

👍︎ 24
💬︎
📅︎ Oct 19 2020
🚨︎ report
Journey to Red Velvet’s Discography (Part 12: RBB)

Holy shit, only the ReVe Festival Trilogy to go, and I’m done with The Red Velvet Journey...I’m not ready. But anywho, just like Perfect Velvet, I heard many good things about RBB’s b-sides, so I was excited to hear what this mini album had.

Really Bad Boy - One of Red Velvet’s more polarizing title tracks. People either love it or hate it. Now, when I first heard this song, I thought it was better than people made it out to be. Though, it can be a bit repetitive. I still think this way. I do love the horror concept for the music video. A lot of people were wondering why was it released on November 30th instead of Halloween, but I heard that it was released that day because that’s when Michael Jackson’s Thriller came out. If that’s the case, then I thought that was pretty sweet. 8.5/10

Butterflies - Again, one of Red Velvet’s well known b-sides. I mean, how can you hate this song? This is like if the word “aesthetic” had its own track. And damn, I didn’t even recognize Wendy’s voice until I looked up the line distribution! Butterflies is just a nice, admittedly cute sounding dance track, and I can see why Reveluvs would love this song. 9/10

So Good - This is one of those songs that gets better within every listen! Almost makes me one of those people who says, “Why couldn’t this be the title track?”...almost. And with me being a simp for R&amp;B, this was an automatic (hehe) like. Also, side tangent: I shouldn’t have looked at the lyrics with my roommate because she was talking about how sexual the lyrics are. Of course, I didn’t really care, I was vibing lol. 10/10

Sassy Me - Right off the bat, Red Velvet are dragging their voices? I need to lie down...Usually, the choruses are my favorite parts, but the verses were golden just for that reason alone. I love how this song arguably got the most attitude out of all the tracks, it really makes me feel like a bad bitch lol. 10/10

Taste - Oh, the old school sound is a nice surprise! But the bigger surprise is Wendy rapping?! Since when did we do this? And how can I get more of that shit? Also, her “Pa-ha!” is kinda funny and cute lol. But yeah, I appreciate how they incorporated more rapping in this song. Also, leave it to Red Velvet to sing about food, we love to see it. The only gripe I have is that the ending came out of nowhere. I thought it was gonna fade out or something. 8.5/10

The song ranking so far

  1. Body Talk - 10
  2. Dumb Dumb - 10
  3. Peek-a-Boo
... keep reading on reddit ➡

👍︎ 18
💬︎
📅︎ Oct 16 2020
🚨︎ report

Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.