menuimage

Description

Usage

Options

Dependencies

License

Changelog

Download

Donation

My_Other_Sites

My_Programs

Comments

form-extractor v2.8 [26 May 2020] 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 the action (i.e. page to be replied to)
-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
-u - debug mode (implementation may vary)
-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.com
# 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&#58://myloginpage.com
# logged in page saved at /tmp/page.htm, enjoy...

Dependencies

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

License

Copyright © 2023 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 https://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.8 [26 May 2020]: add -f (action) option
2.7 [27 Mar 2018]: bugfix when there are spaces in values
2.6 [05 Jun 2017]: bugfix when there are spaces and quotes in values
2.5 [18 May 2017]: add -u (debug) option
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

Donation

I have provided this software free gratis and for nothing. If you would like to thank me with a contribution, please let me know and I will send you a link. Thank you!

My Other Sites

My Programs

Here is a selection of some (other) programs I have written, most of which run under GNU/Linux 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 and tested on an x86-based Linux server, they should run on a Raspberry Pi, and many can run under Windows using Windows Subsystem for Linux (WSL) or 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

Miscellaneous Programs

Comments

This section is closed. If you have a question, please submit it by email, thank you.

No comments yet for '/programs/help/form-extractor.sh.php'