menuimage

Description

Usage

Options

Example

Dependencies

License

Changelog

Download

My_Other_Sites

My_Programs

Comments

form-extractor v2.4 [18 May 2016] by Dominic

Description

Linux/Cygwin program to extract form tags from html. Handy for hacking website form responses; for instance, can be called from another script with -a option to get 'magic' hidden form responses for resubmission using curl or wget.

Usage

form-extractor.sh [options] file_or_web_address

Options

-a - like -d / -F but determine automatically which is appropriate (-d or -F) (only for curl not wget i.e. not with -g)
-c "pathfilename" - use and save any cookies in "pathfilename"
-d - return only hidden and submit tags ready for curl including -d for content type application/x-www-form-urlencoded
-F - return only hidden and submit tags ready for curl including -F for content type multipart/form-data
-g - return only hidden and submit tags ready for wget, including --post-data=
-h - show this help and exit
-i "text" - provide unique identifying text within the form tag to identify the correct form on a page with multiple forms
-j - also show javascript tags
-l - show changelog and exit
-q - be quieter (no header), automatically implied for options -a -d -F -g
-x - skip remote identity verification (--no-check-certificate)

Example

# ... shell (e.g. bash) code snippet example:

# download a remote page containing a single login form, keep/re-use any cookies
curl -b /tmp/cookies -c /tmp/cookies -o /tmp/page.htm https://myloginpage.htm

# use form-extractor.sh to extract all hidden tags on the form
HIDDENTAGS="$(./form-extractor.sh -a /tmp/page.htm)"

# add your own specific data
LOGINTAGS="-F username=houdini -F password=LetMeIn"

# login using any cookies, hidden tags and your specific data
curl -b /tmp/cookies -c /tmp/cookies $HIDDENTAGS $LOGINTAGS -o /tmp/page.htm https://myloginpage.htm

# logged in page saved at /tmp/page.htm, enjoy...

Dependencies

awk sed wget (wget is only required if retrieving from internet)

License

Copyright 2016 Dominic Raferd. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Changelog

2.4 [18 May 2016]: bugfix -i option
2.3 [15 Apr 2016]: use existing cookie file as well as saving there
2.2 [06 Nov 2015]: bugfix hidden/submit tag extraction
2.1 [28 Oct 2015]: more sophisticated hidden/submit tag extraction, better tidying up
2.0 [24 Aug 2015]: bugfixes
1.9 [08 Oct 2014]: bugfix for -a option, add example to help
1.8 [06 Oct 2014]: add submit to hidden tag responses
1.7 [02 Apr 2014]: add -a and -g options
1.6 [13 Mar 2014]: bugfix
1.5 [03 Feb 2014]: bugfix
1.4 [23 Jan 2014]: work with forms which don't use quotes
1.3 [02 Nov 2013]: first public release
1.2 [03 May 2012]: operate on remote web page as well as local files
1.1 [7 Feb 2011]

Download form-extractor.sh

My Other Sites

My Programs

Here is a selection of some (other) programs I have written, most of which run from the command line (CLI), are freely available and can be obtained by clicking on the links. Dependencies are shown and while in most cases written for a conventional Linux server, they should run even on a Raspberry Pi, and many can run under Windows using Cygwin. Email me if you have problems or questions, or if you think I could help with a programming requirement.

Backup Utilities

Debian/Ubuntu kernel and LVM Utilities

Dellmont / Three / Giffgaff / Vodafone - VoIP and Mobile Phone Account Utilities

Miscellaneous Programs

Comments

No comments yet
*Name:
Email:
Hide my email
*Text:
 
Powered by Scriptsmill Comments Script