How do I run code after intercepting web requests? - google-chrome

I have a raspberry pi that I'm already using to track browsing data and block websites using pihole.
What I'm trying to do is search for a specific web request and when I see the request I want to grab the body data so I can perform some code before continuing with the original request.
I looked into proxies but I don't think that's what I need.
I can make it work on the raspberry pi if it would be easy but I would rather make an extension for chrome that can perform a command. Any example code of this would be great.

Related

How to find parameters (variables) in a web site by using google chrome for JMeter

I just started to use JMeter. I want to know how can I see the variables at google chrome. I tried so many ways and I watched lots of videos but there are no answers. Every video says that; you can find it in the network page from console. But on the website which im looking for variables, I just can see JavaScript code token. There is no token as variable. Is there a way to import it into JMeter or is there other way to find variables in google chrome. To put it in a nutshell, I'm working on a project. I want to load test for a website but I got problems with POST request. I cannot login the threads because of cannot find the variables. I need help !! :(
This is what I am trying to reach with screenShot...
This is my chrome's screenShot
I'm just tryna get the parameters like first pic.
There are 2 possibilities:
The "variable" comes in the response, take a closer look at:
response URL as it may be a part of the URL after redirection
response headers (can be observed in the "Network" tab of the developer tools)
response body, you can view page source
The variable gets "calculated" in the browser using JavaScript code. If this is the case you should find the relevant JavaScript function and implement it using JMeter's JSR223 Test Elements
You can also try recording your test scenario using BlazeMeter Proxy Recorder, it's capable of exporting recorded scripts in "SmartJMX" mode with automatic detection and correlation of the dynamic parameters. In case #2 it will not help, but if the variable comes with the response most probably it will be able to detect it. More information: How to Cut Your JMeter Scripting Time by 80%

Setting up Graphhopper (open source version)

I am looking for an alternative to the Google Directions API and run into Graphhopper, as I need to get matrices that provide the distances and travel times between a group of points given by coordinates.
I have installed the Graphhopper server in Java following these instructions, and it seems to be running fine.
As I need to send the requests using Python, I also installed the Python client as shown here. However, it asks for an API key and refers me to the Graphhopper website to get one.
How can I get the client to make a call to the machine where I have installed the server, instead of trying to reach the Graphhopper API? Is this possible? I have been going through the client files but haven't found any place to enter this information.
Thanks in advance!
For anybody in my same situation, I have found an answer. The Matrix API is not open source, so you need to get an API key regardless. Then, you can use the client code (like the one I linked to above) to send queries. The chart of features that are available via the open source code can be found here.
I hope that helps!

getting information from a website in processing?

I am currently making a processing program, where a part of it will be to acess some information from at website. The website will be an HTML file, where some information is stored, which i need to acess and parse. I know how to open a html file, but my problem is that it is supposed to acess a list, which is generated after a login on the website. How do i do that?
This is the website, right after loading the HTML file:
http://i.imgur.com/kGIkyle.png
After a login, the website will begin to spit out data every two seconds.
I wanna acess the data in the ordered list, and i wanna acess it every two seconds in my processing program. How do i do that?
This is the website, after a login, after a moment.
http://i.imgur.com/O743fNJ.png
When you use a web browser to submit a login, you're really interacting with the server. Usually the web browser submits a POST request containing the login information (like a username and password), and the server responds with the next webpage to load.
The details of this are going to depend on the website you're interacting with. Some websites might use AJAX to submit the data and then trigger some JavaScript to run.
The point is, you're going to have to understand exactly how the underlying web server and webpage works. Then you're going to have to use the rules of those interactions to issue the appropriate requests from your Processing code.
It might be as simple as submitting the login credentials in the url itself and then just scraping the information from the webpage.
More likely, you're going to have to interact with some kind of web API and do the requests yourself. Google "Java post request" for more info.
Of course, all of this assumes that the website is open to people using it. If this website isn't yours, it could also be locked down and unavailable to you.

Tail like logging window for my web app?

I am developing an app using Phalcon and would like to create a popup logging window that displays any logging type information when I am logged in (such as DB calls and exceptions).
Alot of my app is driven by Ajax calls. Is it going to be possible to have a window that I can popup on my main app that uses a tail like method of displaying this information?
How would I go about this? I'm not entirely sure that what I want is possible with the Ajax calls as they are done in a different request. I can't find anything on the internet as to how I would go about this so any help would be great.
Well, you didn't said that explicitly, but I imagine that you want this just for development purposes. If so, you can log useful info to a method that checks if it should send that log to the browser based on some criteria (e.g. logged in user is you, the app is in a dev enviroment, etc) and then use Phalcon's FirePHP log adapter to send to log the information to the browser.
You'll just need to have some FirePHP extension in your Firefox or Chrome to be able to see the information under your JavaScript console. And yes, it works well with Ajax calls too.
Let me know if you need further explanations on this...
I think you are looking for a debug toolkit.. There are lot of toolkit available on packagist.org and phalconist.com. I personally like this phalcon-debug-widget toolkit that you may try.

Connecting To MySQL Database with my iOS App

I am writing an iOS app for my school to keep track of pupil's rewards, grades, etc.
I need to connect to a MySQL online database with my app, I need to be able to upload to it, query it, and download the results to display in my app.
I think I need to do this via a PHP page, however there is no reasonably clear tutorial on how to do it. Any help would be appreciated!
Thanks in advance!
You need a webserver with a PHP/ASP/JSP/etc script to interact with the database. Create an API with common operations like SELECT, UPDATE or INSERT, and then call this url's inside the iOS app.
Usefull links:
Making HTTP and HTTPS Requests
Sending HTTP-Post ios
Authenticating Iphone Login with PHP/MySQL and HTTP Responses