JS Page Searcher - javascript

I need to bruteforce through pages and check it's contents for certain text.
ie. I have page: http://example.whatever/internet?ip=$4.2$$.$$6.$$$ and those dollar signs, are missing numbers. I need to go through all of existing combinations untill 404 - Page not found text isn't present on that page anymore (it's not an error code, that gets returned, just the text.)
I also need to be able to use it when there is login required to access the pages, and I have the necessary access, that's why I suggest JS to be used in this, and not server side script, like PHP or Python.
Edit 1: In case you want to complain, that this is not a question, I'm asking how to do it. And if you don't have the balls (or whatever it is you have or don't have) to comment bellow, why you did press that arrow down next to this question, so we can resolve it, please don't do it. Thanks for understanding.

I'd recommend using something like PhantomJS for this. You could login then iterate through pages until you find a non-404 page.

Related

Add some characters to the end of URL

I use a WordPress theme that has a number of custom post types. When I search for these post types, in the results page, the display order is from the oldest post to the newest post, but I want the newer posts to be displayed first.
I didn't design this template, so I don't know how to code it.
I found that by putting orderby=new at the end of the URL of the site, the display order is fixed.
Is there a way to automatically add this phrase to the end of the URL when someone enters the results page?
The links are like this: mydomain.com/activites/?location_name=paris&location_id=&taxonomy%5Bst_tour_type%5D= to the phrase mydomain.com/activites/? It is constant in all searches and after that, it changes based on the term that the user searches for.
The word location is the post type and the rest of the parts that come in the url are taxonomy.
immediate answer:
Write the link to the page accordingly. All other solutions will require changing some of the code or settings.
From my understanding of your question the cleanest solution is probably just to include a link back to the page itself with an added &orderby=new
Label the link in a way that makes it obvious to the user what it does. In this case I would assume ordering some type of content by release or entry date.
recommended solution:
Change the script in way that makes that order the default. It seems to be what you ideally "want". But can't do. As implied by the question.
janky solution:
Add a redirect. It's the same thing I said before but automatic without user input. The only benefit to this is being able to avoid touching existing code. And apply to all users as default.
roundabout solution, that will make maintenance a nightmare long term:
Rewrite rules in your web server. If you don't have access to that: try .htaccess
But since this modifies the behavior in a not immediately obvious way if is missing. And this will be easily missed by merit of being a hidden file and this type of config override not always being allowed. This might lead to non intuitive problems in the future.

Pass innerText value of a page to Chrome extension without opening the page

I've been looking all over for this, and I think the problem is that I inherently suck at programming or scripting of any sort, and I don't know the right words to use...
Basically: I want to make a Chrome extension that reads the the innerText value from the ticketing system at the place I work with. As an example...
<span class="infomsg">Tickets Found [<span id="tickets_count">5</span>]</span>
The goal would be for the extension to display the text "5" over the icon.
What's the best way to do this? I've tried configuring the background.html page with an iframe with the URL with the ticket count as the source, but then I run into the cross-domain scripting issue. document.getElementById("tickets_count").innerHTML can't use a specified URL, as near as I've found.
I'm sure I haven't described it very well at all - totally floundering here, to be honest...let me know what I can clarify, and I'll edit my post.
Thanks!
It depends on whether the page you're looking at is static (e.g. the server sends you HTML with this information already in it) or dynamic (e.g. some JavaScript on the page requests additional information and then adds this to the page).
If it's static, you can use XHR to request the page and find the string you need in the "raw" HTML response. You can't use getElementById in that case - you'll need to find a way to find the string yourself.
If it's dynamic, that won't work. An iframe-in-the-background approach is valid - but you can't access the contents of the iframe. Instead, you should inject a content script in that page and request the information you need.
I understand it's a broad answer - but your question is also quite broad.

Sharepoint - How to: dynamic Url for Note on Noteboard

I'm quite new to SharePoint (about 1 week into it actually) and I'm attempting to mirror certain functionality that my company has with other products. Currently I'm working on how to duplicate the tasking environment in Box.com. Essentially it's just an email link that goes to a webpage where users can view an image and comments related to that image side by side.
I can dynamically load the image based on url parameters using just Javascript so that part is not a problem. As far as the comments part goes I've been trying to use a Noteboard WebPart, and then my desire is to have the "Url for Note" property to change dependent on the same URL parameter. I've looked over the Javascript Object Model and Class Library on MSDN but the hierarchy seems to stop at WebPart so I'm not finding anything that will allow me to update the Url for Note property.
I've read comments saying that there's a lot of exploration involved with this so I've tried the following:
-loading the javascript files into VisualStudio to use intellisense for looking up functions and properties in the SP.js files.
-console.log() on: WebPartDefinitionCollection, WebPartDefinition, WebPart, and methods .get_objectData(), get_properties() on all the previous
-embedding script in the "Builder" on the Url for Note property (where it says "click to use Builder" - I'm still not sure what more this offers than just a bigger textbox to put in the URL path)
I'm certain I've missed something obvious here but am gaining information very slowly now that I've exhausted the usual suspects. I very much appreciate any more resources or information anyone has and am willing to accept that I may be approaching this incorrectly if someone has accomplished this before.
Normally I'd keep going through whatever info I could find but I'm currently on a trial period and start school back up again soon so I won't have as much time with it. Apologies if this seems impatient, I'm just not sure where else to look at the moment.
Did you check out the API libraries like SPServices or SharepointPlus? They could help you doing what you want...
For example with SharepointPlus you could:
Create a Sharepoint List with a "Note" column and whatever you need to record
When the user goes to the page with the image you just show a TEXTAREA input with a SAVE button
When the user hits the SAVE button it will save the Note to the related list using $SP().list("Your list").add()
And you can easily retrieve the information (to show them to the user if he goes back to the page) with $SP().list("Your list").get()
If I understood your problem, that way it may be easier for you to deal with a customized page :-)

submitting asp form by using JQuery ajax

Firstly, some short explanations for the pages that we will be using here in the example.
A.asp
The page where user interacts with various controls, fills the info, and submits the form.
B.asp
The page that creates session variables and stores values as well as serves as an intermediate page where it passes value / redirects to C.asp.
C.asp
The page that does processing and displays results.
So in short, the flow is something like, A -> B -> C
Now, what I'd like to achieve is to put the results right on A.asp instead of seeing them on C.asp. I guess I should be able to do it with JQuery Ajax, perhaps simply by using $("div#loadResults").load("B.asp").
But somehow I couldn't make it happen with above line of code. I think I must have missed something there. Can anyone kindly give suggestions or thoughts?
Thanks.
EDIT:
It is actually a massive Form, so I don't think it'd be good idea to upload huge chunk of code directly to here.
EDIT2:
Another question is: which of the following should I be using, Button.click(), Button.submit() or Form.submit()?

Executing JavaScript on page load selectively

Mending a bug in our SAP BW web application, I need to call two javascript functions from the web framework library upon page load. The problem is that each of these functions reloads the page as a side-effect. In addition, I don't have access to modify these functions.
Any great ideas on how to execute a piece of code on "real" page load, then another piece of code on the subsequent load caused by this function, and then execute no code the third reload?
My best idea so far it to set a cookie on each go to determine what to run. I don't greatly love this solution. Anything better would be very welcome. And by the way, I do realize loading a page three times is absolutely ridiculous, but that's how we roll with SAP.
A cookie would work just fine. Or you could modify the query string each time with a "mode=x" or "load=x" parameter.
This would present a problem if the user tries to bookmark the final page, though. If that's an option, the cookie solution is fine. I would guess they need cookies enabled to get that far in the app anyway?
A cookie, or pass a query string parameter indicating which javascript function has been run. We had to do something along these lines to trip out a piece of our software. That's really the best I got.
Use a cookie or set a hidden field value. My vote would be for the field value.
This might be a cute case for using window.name, 'the property that survives page reloads'.

Categories

Resources