split command parsing
This commit is contained in:
		| @ -4,6 +4,8 @@ | |||||||
|     xmlns:xs="http://www.w3.org/2001/XMLSchema" |     xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||||||
|     version="1.1"> |     version="1.1"> | ||||||
|  |  | ||||||
|  |     <xsl:import href="parseCommand.xsl"/>  | ||||||
|  |  | ||||||
|     <xsl:output method="html" encoding="UTF-8"/> |     <xsl:output method="html" encoding="UTF-8"/> | ||||||
|     <xsl:output indent="yes"/> |     <xsl:output indent="yes"/> | ||||||
|     <xsl:strip-space elements='*'/> |     <xsl:strip-space elements='*'/> | ||||||
| @ -40,7 +42,7 @@ | |||||||
|                             <xsl:text>/scan.php?targets=</xsl:text> |                             <xsl:text>/scan.php?targets=</xsl:text> | ||||||
|                             <xsl:value-of select="$targets"/> |                             <xsl:value-of select="$targets"/> | ||||||
|                             <xsl:text>&</xsl:text> |                             <xsl:text>&</xsl:text> | ||||||
|                             <xsl:call-template name="optionsList"> |                             <xsl:call-template name="parseCommand"> | ||||||
|                                 <xsl:with-param name="argList" select="substring-before(substring-after(@args, ' -'), ' -oX')"/> |                                 <xsl:with-param name="argList" select="substring-before(substring-after(@args, ' -'), ' -oX')"/> | ||||||
|                                 <xsl:with-param name="asURL" select="true()"/> |                                 <xsl:with-param name="asURL" select="true()"/> | ||||||
|                             </xsl:call-template> |                             </xsl:call-template> | ||||||
| @ -79,7 +81,7 @@ | |||||||
|                         <xsl:text>can</xsl:text> |                         <xsl:text>can</xsl:text> | ||||||
|                     </a> |                     </a> | ||||||
|                     <form id="lanScanForm" class="right menu"> |                     <form id="lanScanForm" class="right menu"> | ||||||
|                         <xsl:call-template name="optionsList"> |                         <xsl:call-template name="parseCommand"> | ||||||
|                             <xsl:with-param name="argList" select="substring-before(substring-after(@args, ' -'), ' -oX')"/> |                             <xsl:with-param name="argList" select="substring-before(substring-after(@args, ' -'), ' -oX')"/> | ||||||
|                             <xsl:with-param name="asURL" select="false()"/> |                             <xsl:with-param name="asURL" select="false()"/> | ||||||
|                         </xsl:call-template> |                         </xsl:call-template> | ||||||
| @ -371,92 +373,4 @@ function hostScanning(link) { | |||||||
|         </a> |         </a> | ||||||
|     </xsl:template> |     </xsl:template> | ||||||
|  |  | ||||||
|     <xsl:template name="optionsList"> |  | ||||||
|         <xsl:param name="argList" select=""/> |  | ||||||
|         <xsl:param name="asURL" select="false()"/> |  | ||||||
|         <xsl:variable name="nextArgs" select="substring-after($argList, ' -')"/> |  | ||||||
|         <xsl:variable name="argAndValue"> |  | ||||||
|             <xsl:choose> |  | ||||||
|                 <xsl:when test="$nextArgs"> |  | ||||||
|                     <xsl:value-of select="substring-before($argList, ' -')"/> |  | ||||||
|                 </xsl:when> |  | ||||||
|                 <xsl:otherwise><xsl:value-of select="$argList"/></xsl:otherwise> |  | ||||||
|             </xsl:choose> |  | ||||||
|         </xsl:variable> |  | ||||||
|  |  | ||||||
|         <xsl:choose> |  | ||||||
|             <xsl:when test="starts-with($argAndValue, '-')"> |  | ||||||
|                 <xsl:choose> |  | ||||||
|                     <xsl:when test="contains($argAndValue, ' ')"> |  | ||||||
|                         <xsl:call-template name="input"> |  | ||||||
|                             <xsl:with-param name="name" select="substring-before($argAndValue, ' ')"/> |  | ||||||
|                             <xsl:with-param name="value" select="substring-after($argAndValue, ' ')"/> |  | ||||||
|                             <xsl:with-param name="asURL" select="$asURL"/> |  | ||||||
|                         </xsl:call-template> |  | ||||||
|                     </xsl:when> |  | ||||||
|                     <xsl:otherwise> |  | ||||||
|                         <xsl:call-template name="input"> |  | ||||||
|                             <xsl:with-param name="name" select="$argAndValue"/> |  | ||||||
|                             <xsl:with-param name="value" select="on"/> |  | ||||||
|                             <xsl:with-param name="asURL" select="$asURL"/> |  | ||||||
|                         </xsl:call-template> |  | ||||||
|                     </xsl:otherwise> |  | ||||||
|                 </xsl:choose> |  | ||||||
|             </xsl:when> |  | ||||||
|             <xsl:otherwise> |  | ||||||
|                 <xsl:choose> |  | ||||||
|                     <xsl:when test="starts-with($argAndValue, 'P') or starts-with($argAndValue, 's') or starts-with($argAndValue, 'o')"> |  | ||||||
|                         <xsl:call-template name="input"> |  | ||||||
|                             <xsl:with-param name="name" select="substring($argAndValue, 1, 2)"/> |  | ||||||
|                             <xsl:with-param name="value" select="substring($argAndValue, 3)"/> |  | ||||||
|                             <xsl:with-param name="asURL" select="$asURL"/> |  | ||||||
|                         </xsl:call-template> |  | ||||||
|                     </xsl:when> |  | ||||||
|                     <xsl:otherwise> |  | ||||||
|                         <xsl:call-template name="input"> |  | ||||||
|                             <xsl:with-param name="name" select="substring($argAndValue, 1, 1)"/> |  | ||||||
|                             <xsl:with-param name="value" select="substring($argAndValue, 2)"/> |  | ||||||
|                             <xsl:with-param name="asURL" select="$asURL"/> |  | ||||||
|                         </xsl:call-template> |  | ||||||
|                     </xsl:otherwise> |  | ||||||
|                 </xsl:choose> |  | ||||||
|             </xsl:otherwise> |  | ||||||
|         </xsl:choose> |  | ||||||
|  |  | ||||||
|         <xsl:if test="$nextArgs"> |  | ||||||
|             <xsl:call-template name="optionsList"> |  | ||||||
|                 <xsl:with-param name="argList" select="$nextArgs"/> |  | ||||||
|                 <xsl:with-param name="asURL" select="$asURL"/> |  | ||||||
|             </xsl:call-template> |  | ||||||
|         </xsl:if> |  | ||||||
|     </xsl:template> |  | ||||||
|  |  | ||||||
|     <xsl:template name="input"> |  | ||||||
|         <xsl:param name="name"/> |  | ||||||
|         <xsl:param name="value" select=""/> |  | ||||||
|         <xsl:param name="asURL" select="false()"/> |  | ||||||
|         <xsl:choose> |  | ||||||
|             <xsl:when test="$asURL"> |  | ||||||
|                 <xsl:text>-</xsl:text> |  | ||||||
|                 <xsl:value-of select="$name"/> |  | ||||||
|                 <xsl:text>=</xsl:text> |  | ||||||
|                 <xsl:choose> |  | ||||||
|                     <xsl:when test="$value"><xsl:value-of select="$value"/></xsl:when> |  | ||||||
|                     <xsl:otherwise>on</xsl:otherwise> |  | ||||||
|                 </xsl:choose> |  | ||||||
|                 <xsl:text>&</xsl:text> |  | ||||||
|             </xsl:when> |  | ||||||
|             <xsl:otherwise> |  | ||||||
|                 <input type="hidden" name="-{$name}"> |  | ||||||
|                     <xsl:attribute name="value"> |  | ||||||
|                         <xsl:choose> |  | ||||||
|                             <xsl:when test="$value"><xsl:value-of select="$value"/></xsl:when> |  | ||||||
|                             <xsl:otherwise>on</xsl:otherwise> |  | ||||||
|                         </xsl:choose> |  | ||||||
|                     </xsl:attribute> |  | ||||||
|                 </input> |  | ||||||
|             </xsl:otherwise> |  | ||||||
|         </xsl:choose> |  | ||||||
|     </xsl:template> |  | ||||||
|  |  | ||||||
| </xsl:stylesheet> | </xsl:stylesheet> | ||||||
| @ -4,6 +4,8 @@ | |||||||
|     xmlns:xs="http://www.w3.org/2001/XMLSchema" |     xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||||||
|     version="1.1"> |     version="1.1"> | ||||||
|  |  | ||||||
|  |     <xsl:import href="parseCommand.xsl"/>  | ||||||
|  |  | ||||||
|     <xsl:output method="html" encoding="UTF-8"/> |     <xsl:output method="html" encoding="UTF-8"/> | ||||||
|     <xsl:output indent="yes"/> |     <xsl:output indent="yes"/> | ||||||
|     <xsl:strip-space elements='*'/> |     <xsl:strip-space elements='*'/> | ||||||
| @ -40,7 +42,7 @@ | |||||||
|                             <xsl:text>/scan.php?targets=</xsl:text> |                             <xsl:text>/scan.php?targets=</xsl:text> | ||||||
|                             <xsl:value-of select="$targets"/> |                             <xsl:value-of select="$targets"/> | ||||||
|                             <xsl:text>&</xsl:text> |                             <xsl:text>&</xsl:text> | ||||||
|                             <xsl:call-template name="optionsList"> |                             <xsl:call-template name="parseCommand"> | ||||||
|                                 <xsl:with-param name="argList" select="substring-before(substring-after(@args, ' -'), ' -oX')"/> |                                 <xsl:with-param name="argList" select="substring-before(substring-after(@args, ' -'), ' -oX')"/> | ||||||
|                                 <xsl:with-param name="asURL" select="true()"/> |                                 <xsl:with-param name="asURL" select="true()"/> | ||||||
|                             </xsl:call-template> |                             </xsl:call-template> | ||||||
| @ -93,7 +95,7 @@ | |||||||
|                         <xsl:text>can</xsl:text> |                         <xsl:text>can</xsl:text> | ||||||
|                     </a> |                     </a> | ||||||
|                     <form id="lanScanForm" class="right menu"> |                     <form id="lanScanForm" class="right menu"> | ||||||
|                         <xsl:call-template name="optionsList"> |                         <xsl:call-template name="parseCommand"> | ||||||
|                             <xsl:with-param name="argList" select="substring-before(substring-after(@args, ' -'), ' -oX')"/> |                             <xsl:with-param name="argList" select="substring-before(substring-after(@args, ' -'), ' -oX')"/> | ||||||
|                             <xsl:with-param name="asURL" select="false()"/> |                             <xsl:with-param name="asURL" select="false()"/> | ||||||
|                         </xsl:call-template> |                         </xsl:call-template> | ||||||
| @ -358,92 +360,4 @@ function hostScanning(link) { | |||||||
|         </a> |         </a> | ||||||
|     </xsl:template> |     </xsl:template> | ||||||
|  |  | ||||||
|     <xsl:template name="optionsList"> |  | ||||||
|         <xsl:param name="argList" select=""/> |  | ||||||
|         <xsl:param name="asURL" select="false()"/> |  | ||||||
|         <xsl:variable name="nextArgs" select="substring-after($argList, ' -')"/> |  | ||||||
|         <xsl:variable name="argAndValue"> |  | ||||||
|             <xsl:choose> |  | ||||||
|                 <xsl:when test="$nextArgs"> |  | ||||||
|                     <xsl:value-of select="substring-before($argList, ' -')"/> |  | ||||||
|                 </xsl:when> |  | ||||||
|                 <xsl:otherwise><xsl:value-of select="$argList"/></xsl:otherwise> |  | ||||||
|             </xsl:choose> |  | ||||||
|         </xsl:variable> |  | ||||||
|  |  | ||||||
|         <xsl:choose> |  | ||||||
|             <xsl:when test="starts-with($argAndValue, '-')"> |  | ||||||
|                 <xsl:choose> |  | ||||||
|                     <xsl:when test="contains($argAndValue, ' ')"> |  | ||||||
|                         <xsl:call-template name="input"> |  | ||||||
|                             <xsl:with-param name="name" select="substring-before($argAndValue, ' ')"/> |  | ||||||
|                             <xsl:with-param name="value" select="substring-after($argAndValue, ' ')"/> |  | ||||||
|                             <xsl:with-param name="asURL" select="$asURL"/> |  | ||||||
|                         </xsl:call-template> |  | ||||||
|                     </xsl:when> |  | ||||||
|                     <xsl:otherwise> |  | ||||||
|                         <xsl:call-template name="input"> |  | ||||||
|                             <xsl:with-param name="name" select="$argAndValue"/> |  | ||||||
|                             <xsl:with-param name="value" select="on"/> |  | ||||||
|                             <xsl:with-param name="asURL" select="$asURL"/> |  | ||||||
|                         </xsl:call-template> |  | ||||||
|                     </xsl:otherwise> |  | ||||||
|                 </xsl:choose> |  | ||||||
|             </xsl:when> |  | ||||||
|             <xsl:otherwise> |  | ||||||
|                 <xsl:choose> |  | ||||||
|                     <xsl:when test="starts-with($argAndValue, 'P') or starts-with($argAndValue, 's') or starts-with($argAndValue, 'o')"> |  | ||||||
|                         <xsl:call-template name="input"> |  | ||||||
|                             <xsl:with-param name="name" select="substring($argAndValue, 1, 2)"/> |  | ||||||
|                             <xsl:with-param name="value" select="substring($argAndValue, 3)"/> |  | ||||||
|                             <xsl:with-param name="asURL" select="$asURL"/> |  | ||||||
|                         </xsl:call-template> |  | ||||||
|                     </xsl:when> |  | ||||||
|                     <xsl:otherwise> |  | ||||||
|                         <xsl:call-template name="input"> |  | ||||||
|                             <xsl:with-param name="name" select="substring($argAndValue, 1, 1)"/> |  | ||||||
|                             <xsl:with-param name="value" select="substring($argAndValue, 2)"/> |  | ||||||
|                             <xsl:with-param name="asURL" select="$asURL"/> |  | ||||||
|                         </xsl:call-template> |  | ||||||
|                     </xsl:otherwise> |  | ||||||
|                 </xsl:choose> |  | ||||||
|             </xsl:otherwise> |  | ||||||
|         </xsl:choose> |  | ||||||
|  |  | ||||||
|         <xsl:if test="$nextArgs"> |  | ||||||
|             <xsl:call-template name="optionsList"> |  | ||||||
|                 <xsl:with-param name="argList" select="$nextArgs"/> |  | ||||||
|                 <xsl:with-param name="asURL" select="$asURL"/> |  | ||||||
|             </xsl:call-template> |  | ||||||
|         </xsl:if> |  | ||||||
|     </xsl:template> |  | ||||||
|  |  | ||||||
|     <xsl:template name="input"> |  | ||||||
|         <xsl:param name="name"/> |  | ||||||
|         <xsl:param name="value" select=""/> |  | ||||||
|         <xsl:param name="asURL" select="false()"/> |  | ||||||
|         <xsl:choose> |  | ||||||
|             <xsl:when test="$asURL"> |  | ||||||
|                 <xsl:text>-</xsl:text> |  | ||||||
|                 <xsl:value-of select="$name"/> |  | ||||||
|                 <xsl:text>=</xsl:text> |  | ||||||
|                 <xsl:choose> |  | ||||||
|                     <xsl:when test="$value"><xsl:value-of select="$value"/></xsl:when> |  | ||||||
|                     <xsl:otherwise>on</xsl:otherwise> |  | ||||||
|                 </xsl:choose> |  | ||||||
|                 <xsl:text>&</xsl:text> |  | ||||||
|             </xsl:when> |  | ||||||
|             <xsl:otherwise> |  | ||||||
|                 <input type="hidden" name="-{$name}"> |  | ||||||
|                     <xsl:attribute name="value"> |  | ||||||
|                         <xsl:choose> |  | ||||||
|                             <xsl:when test="$value"><xsl:value-of select="$value"/></xsl:when> |  | ||||||
|                             <xsl:otherwise>on</xsl:otherwise> |  | ||||||
|                         </xsl:choose> |  | ||||||
|                     </xsl:attribute> |  | ||||||
|                 </input> |  | ||||||
|             </xsl:otherwise> |  | ||||||
|         </xsl:choose> |  | ||||||
|     </xsl:template> |  | ||||||
|  |  | ||||||
| </xsl:stylesheet> | </xsl:stylesheet> | ||||||
| @ -4,6 +4,8 @@ | |||||||
|     xmlns:xs="http://www.w3.org/2001/XMLSchema" |     xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||||||
|     version="1.1"> |     version="1.1"> | ||||||
|  |  | ||||||
|  |     <xsl:import href="parseCommand.xsl"/>  | ||||||
|  |  | ||||||
|     <xsl:output method="html" encoding="UTF-8"/> |     <xsl:output method="html" encoding="UTF-8"/> | ||||||
|     <xsl:output indent="yes"/> |     <xsl:output indent="yes"/> | ||||||
|     <xsl:strip-space elements='*'/> |     <xsl:strip-space elements='*'/> | ||||||
| @ -40,7 +42,7 @@ | |||||||
|                             <xsl:text>/scan.php?targets=</xsl:text> |                             <xsl:text>/scan.php?targets=</xsl:text> | ||||||
|                             <xsl:value-of select="$targets"/> |                             <xsl:value-of select="$targets"/> | ||||||
|                             <xsl:text>&</xsl:text> |                             <xsl:text>&</xsl:text> | ||||||
|                             <xsl:call-template name="optionsList"> |                             <xsl:call-template name="parseCommand"> | ||||||
|                                 <xsl:with-param name="argList" select="substring-before(substring-after(@args, ' -'), ' -oX')"/> |                                 <xsl:with-param name="argList" select="substring-before(substring-after(@args, ' -'), ' -oX')"/> | ||||||
|                                 <xsl:with-param name="asURL" select="true()"/> |                                 <xsl:with-param name="asURL" select="true()"/> | ||||||
|                             </xsl:call-template> |                             </xsl:call-template> | ||||||
| @ -79,7 +81,7 @@ | |||||||
|                         <xsl:text>can</xsl:text> |                         <xsl:text>can</xsl:text> | ||||||
|                     </a> |                     </a> | ||||||
|                     <form id="lanScanForm" class="right menu"> |                     <form id="lanScanForm" class="right menu"> | ||||||
|                         <xsl:call-template name="optionsList"> |                         <xsl:call-template name="parseCommand"> | ||||||
|                             <xsl:with-param name="argList" select="substring-before(substring-after(@args, ' -'), ' -oX')"/> |                             <xsl:with-param name="argList" select="substring-before(substring-after(@args, ' -'), ' -oX')"/> | ||||||
|                             <xsl:with-param name="asURL" select="false()"/> |                             <xsl:with-param name="asURL" select="false()"/> | ||||||
|                         </xsl:call-template> |                         </xsl:call-template> | ||||||
| @ -402,92 +404,4 @@ function hostScanning(link) { | |||||||
|         </a> |         </a> | ||||||
|     </xsl:template> |     </xsl:template> | ||||||
|  |  | ||||||
|     <xsl:template name="optionsList"> |  | ||||||
|         <xsl:param name="argList" select=""/> |  | ||||||
|         <xsl:param name="asURL" select="false()"/> |  | ||||||
|         <xsl:variable name="nextArgs" select="substring-after($argList, ' -')"/> |  | ||||||
|         <xsl:variable name="argAndValue"> |  | ||||||
|             <xsl:choose> |  | ||||||
|                 <xsl:when test="$nextArgs"> |  | ||||||
|                     <xsl:value-of select="substring-before($argList, ' -')"/> |  | ||||||
|                 </xsl:when> |  | ||||||
|                 <xsl:otherwise><xsl:value-of select="$argList"/></xsl:otherwise> |  | ||||||
|             </xsl:choose> |  | ||||||
|         </xsl:variable> |  | ||||||
|  |  | ||||||
|         <xsl:choose> |  | ||||||
|             <xsl:when test="starts-with($argAndValue, '-')"> |  | ||||||
|                 <xsl:choose> |  | ||||||
|                     <xsl:when test="contains($argAndValue, ' ')"> |  | ||||||
|                         <xsl:call-template name="input"> |  | ||||||
|                             <xsl:with-param name="name" select="substring-before($argAndValue, ' ')"/> |  | ||||||
|                             <xsl:with-param name="value" select="substring-after($argAndValue, ' ')"/> |  | ||||||
|                             <xsl:with-param name="asURL" select="$asURL"/> |  | ||||||
|                         </xsl:call-template> |  | ||||||
|                     </xsl:when> |  | ||||||
|                     <xsl:otherwise> |  | ||||||
|                         <xsl:call-template name="input"> |  | ||||||
|                             <xsl:with-param name="name" select="$argAndValue"/> |  | ||||||
|                             <xsl:with-param name="value" select="on"/> |  | ||||||
|                             <xsl:with-param name="asURL" select="$asURL"/> |  | ||||||
|                         </xsl:call-template> |  | ||||||
|                     </xsl:otherwise> |  | ||||||
|                 </xsl:choose> |  | ||||||
|             </xsl:when> |  | ||||||
|             <xsl:otherwise> |  | ||||||
|                 <xsl:choose> |  | ||||||
|                     <xsl:when test="starts-with($argAndValue, 'P') or starts-with($argAndValue, 's') or starts-with($argAndValue, 'o')"> |  | ||||||
|                         <xsl:call-template name="input"> |  | ||||||
|                             <xsl:with-param name="name" select="substring($argAndValue, 1, 2)"/> |  | ||||||
|                             <xsl:with-param name="value" select="substring($argAndValue, 3)"/> |  | ||||||
|                             <xsl:with-param name="asURL" select="$asURL"/> |  | ||||||
|                         </xsl:call-template> |  | ||||||
|                     </xsl:when> |  | ||||||
|                     <xsl:otherwise> |  | ||||||
|                         <xsl:call-template name="input"> |  | ||||||
|                             <xsl:with-param name="name" select="substring($argAndValue, 1, 1)"/> |  | ||||||
|                             <xsl:with-param name="value" select="substring($argAndValue, 2)"/> |  | ||||||
|                             <xsl:with-param name="asURL" select="$asURL"/> |  | ||||||
|                         </xsl:call-template> |  | ||||||
|                     </xsl:otherwise> |  | ||||||
|                 </xsl:choose> |  | ||||||
|             </xsl:otherwise> |  | ||||||
|         </xsl:choose> |  | ||||||
|  |  | ||||||
|         <xsl:if test="$nextArgs"> |  | ||||||
|             <xsl:call-template name="optionsList"> |  | ||||||
|                 <xsl:with-param name="argList" select="$nextArgs"/> |  | ||||||
|                 <xsl:with-param name="asURL" select="$asURL"/> |  | ||||||
|             </xsl:call-template> |  | ||||||
|         </xsl:if> |  | ||||||
|     </xsl:template> |  | ||||||
|  |  | ||||||
|     <xsl:template name="input"> |  | ||||||
|         <xsl:param name="name"/> |  | ||||||
|         <xsl:param name="value" select=""/> |  | ||||||
|         <xsl:param name="asURL" select="false()"/> |  | ||||||
|         <xsl:choose> |  | ||||||
|             <xsl:when test="$asURL"> |  | ||||||
|                 <xsl:text>-</xsl:text> |  | ||||||
|                 <xsl:value-of select="$name"/> |  | ||||||
|                 <xsl:text>=</xsl:text> |  | ||||||
|                 <xsl:choose> |  | ||||||
|                     <xsl:when test="$value"><xsl:value-of select="$value"/></xsl:when> |  | ||||||
|                     <xsl:otherwise>on</xsl:otherwise> |  | ||||||
|                 </xsl:choose> |  | ||||||
|                 <xsl:text>&</xsl:text> |  | ||||||
|             </xsl:when> |  | ||||||
|             <xsl:otherwise> |  | ||||||
|                 <input type="hidden" name="-{$name}"> |  | ||||||
|                     <xsl:attribute name="value"> |  | ||||||
|                         <xsl:choose> |  | ||||||
|                             <xsl:when test="$value"><xsl:value-of select="$value"/></xsl:when> |  | ||||||
|                             <xsl:otherwise>on</xsl:otherwise> |  | ||||||
|                         </xsl:choose> |  | ||||||
|                     </xsl:attribute> |  | ||||||
|                 </input> |  | ||||||
|             </xsl:otherwise> |  | ||||||
|         </xsl:choose> |  | ||||||
|     </xsl:template> |  | ||||||
|  |  | ||||||
| </xsl:stylesheet> | </xsl:stylesheet> | ||||||
							
								
								
									
										95
									
								
								templates/parseCommand.xsl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										95
									
								
								templates/parseCommand.xsl
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,95 @@ | |||||||
|  | <?xml version="1.0" encoding="utf-8"?> | ||||||
|  | <xsl:stylesheet | ||||||
|  |     xmlns:xsl="http://www.w3.org/1999/XSL/Transform" | ||||||
|  |     xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||||||
|  |     version="1.1"> | ||||||
|  |  | ||||||
|  |     <xsl:template name="parseCommand"> | ||||||
|  |         <xsl:param name="argList" select=""/> | ||||||
|  |         <xsl:param name="asURL" select="false()"/> | ||||||
|  |         <xsl:variable name="nextArgs" select="substring-after($argList, ' -')"/> | ||||||
|  |         <xsl:variable name="argAndValue"> | ||||||
|  |             <xsl:choose> | ||||||
|  |                 <xsl:when test="$nextArgs"> | ||||||
|  |                     <xsl:value-of select="substring-before($argList, ' -')"/> | ||||||
|  |                 </xsl:when> | ||||||
|  |                 <xsl:otherwise><xsl:value-of select="$argList"/></xsl:otherwise> | ||||||
|  |             </xsl:choose> | ||||||
|  |         </xsl:variable> | ||||||
|  |  | ||||||
|  |         <xsl:choose> | ||||||
|  |             <xsl:when test="starts-with($argAndValue, '-')"> | ||||||
|  |                 <xsl:choose> | ||||||
|  |                     <xsl:when test="contains($argAndValue, ' ')"> | ||||||
|  |                         <xsl:call-template name="input"> | ||||||
|  |                             <xsl:with-param name="name" select="substring-before($argAndValue, ' ')"/> | ||||||
|  |                             <xsl:with-param name="value" select="substring-after($argAndValue, ' ')"/> | ||||||
|  |                             <xsl:with-param name="asURL" select="$asURL"/> | ||||||
|  |                         </xsl:call-template> | ||||||
|  |                     </xsl:when> | ||||||
|  |                     <xsl:otherwise> | ||||||
|  |                         <xsl:call-template name="input"> | ||||||
|  |                             <xsl:with-param name="name" select="$argAndValue"/> | ||||||
|  |                             <xsl:with-param name="value" select="on"/> | ||||||
|  |                             <xsl:with-param name="asURL" select="$asURL"/> | ||||||
|  |                         </xsl:call-template> | ||||||
|  |                     </xsl:otherwise> | ||||||
|  |                 </xsl:choose> | ||||||
|  |             </xsl:when> | ||||||
|  |             <xsl:otherwise> | ||||||
|  |                 <xsl:choose> | ||||||
|  |                     <xsl:when test="starts-with($argAndValue, 'P') or starts-with($argAndValue, 's') or starts-with($argAndValue, 'o')"> | ||||||
|  |                         <xsl:call-template name="input"> | ||||||
|  |                             <xsl:with-param name="name" select="substring($argAndValue, 1, 2)"/> | ||||||
|  |                             <xsl:with-param name="value" select="substring($argAndValue, 3)"/> | ||||||
|  |                             <xsl:with-param name="asURL" select="$asURL"/> | ||||||
|  |                         </xsl:call-template> | ||||||
|  |                     </xsl:when> | ||||||
|  |                     <xsl:otherwise> | ||||||
|  |                         <xsl:call-template name="input"> | ||||||
|  |                             <xsl:with-param name="name" select="substring($argAndValue, 1, 1)"/> | ||||||
|  |                             <xsl:with-param name="value" select="substring($argAndValue, 2)"/> | ||||||
|  |                             <xsl:with-param name="asURL" select="$asURL"/> | ||||||
|  |                         </xsl:call-template> | ||||||
|  |                     </xsl:otherwise> | ||||||
|  |                 </xsl:choose> | ||||||
|  |             </xsl:otherwise> | ||||||
|  |         </xsl:choose> | ||||||
|  |  | ||||||
|  |         <xsl:if test="$nextArgs"> | ||||||
|  |             <xsl:call-template name="parseCommand"> | ||||||
|  |                 <xsl:with-param name="argList" select="$nextArgs"/> | ||||||
|  |                 <xsl:with-param name="asURL" select="$asURL"/> | ||||||
|  |             </xsl:call-template> | ||||||
|  |         </xsl:if> | ||||||
|  |     </xsl:template> | ||||||
|  |  | ||||||
|  |     <xsl:template name="input"> | ||||||
|  |         <xsl:param name="name"/> | ||||||
|  |         <xsl:param name="value" select=""/> | ||||||
|  |         <xsl:param name="asURL" select="false()"/> | ||||||
|  |         <xsl:choose> | ||||||
|  |             <xsl:when test="$asURL"> | ||||||
|  |                 <xsl:text>-</xsl:text> | ||||||
|  |                 <xsl:value-of select="$name"/> | ||||||
|  |                 <xsl:text>=</xsl:text> | ||||||
|  |                 <xsl:choose> | ||||||
|  |                     <xsl:when test="$value"><xsl:value-of select="$value"/></xsl:when> | ||||||
|  |                     <xsl:otherwise>on</xsl:otherwise> | ||||||
|  |                 </xsl:choose> | ||||||
|  |                 <xsl:text>&</xsl:text> | ||||||
|  |             </xsl:when> | ||||||
|  |             <xsl:otherwise> | ||||||
|  |                 <input type="hidden" name="-{$name}"> | ||||||
|  |                     <xsl:attribute name="value"> | ||||||
|  |                         <xsl:choose> | ||||||
|  |                             <xsl:when test="$value"><xsl:value-of select="$value"/></xsl:when> | ||||||
|  |                             <xsl:otherwise>on</xsl:otherwise> | ||||||
|  |                         </xsl:choose> | ||||||
|  |                     </xsl:attribute> | ||||||
|  |                 </input> | ||||||
|  |             </xsl:otherwise> | ||||||
|  |         </xsl:choose> | ||||||
|  |     </xsl:template> | ||||||
|  |  | ||||||
|  | </xsl:stylesheet> | ||||||
| @ -4,6 +4,8 @@ | |||||||
|     xmlns:xs="http://www.w3.org/2001/XMLSchema" |     xmlns:xs="http://www.w3.org/2001/XMLSchema" | ||||||
|     version="1.1"> |     version="1.1"> | ||||||
|  |  | ||||||
|  |     <xsl:import href="parseCommand.xsl"/>  | ||||||
|  |  | ||||||
|     <xsl:output method="html" encoding="UTF-8"/> |     <xsl:output method="html" encoding="UTF-8"/> | ||||||
|     <xsl:output indent="yes"/> |     <xsl:output indent="yes"/> | ||||||
|     <xsl:strip-space elements='*'/> |     <xsl:strip-space elements='*'/> | ||||||
| @ -40,7 +42,7 @@ | |||||||
|                             <xsl:text>/scan.php?targets=</xsl:text> |                             <xsl:text>/scan.php?targets=</xsl:text> | ||||||
|                             <xsl:value-of select="$targets"/> |                             <xsl:value-of select="$targets"/> | ||||||
|                             <xsl:text>&</xsl:text> |                             <xsl:text>&</xsl:text> | ||||||
|                             <xsl:call-template name="optionsList"> |                             <xsl:call-template name="parseCommand"> | ||||||
|                                 <xsl:with-param name="argList" select="substring-before(substring-after(@args, ' -'), ' -oX')"/> |                                 <xsl:with-param name="argList" select="substring-before(substring-after(@args, ' -'), ' -oX')"/> | ||||||
|                                 <xsl:with-param name="asURL" select="true()"/> |                                 <xsl:with-param name="asURL" select="true()"/> | ||||||
|                             </xsl:call-template> |                             </xsl:call-template> | ||||||
| @ -79,7 +81,7 @@ | |||||||
|                         <xsl:text>can</xsl:text> |                         <xsl:text>can</xsl:text> | ||||||
|                     </a> |                     </a> | ||||||
|                     <form id="lanScanForm" class="right menu" onsubmit="targetsInputDiv.classList.add('loading')"> |                     <form id="lanScanForm" class="right menu" onsubmit="targetsInputDiv.classList.add('loading')"> | ||||||
|                         <xsl:call-template name="optionsList"> |                         <xsl:call-template name="parseCommand"> | ||||||
|                             <xsl:with-param name="argList" select="substring-before(substring-after(@args, ' -'), ' -oX')"/> |                             <xsl:with-param name="argList" select="substring-before(substring-after(@args, ' -'), ' -oX')"/> | ||||||
|                             <xsl:with-param name="asURL" select="false()"/> |                             <xsl:with-param name="asURL" select="false()"/> | ||||||
|                         </xsl:call-template> |                         </xsl:call-template> | ||||||
| @ -362,92 +364,4 @@ function hostScanning(link) { | |||||||
|  |  | ||||||
|     </xsl:template> |     </xsl:template> | ||||||
|  |  | ||||||
|     <xsl:template name="optionsList"> |  | ||||||
|         <xsl:param name="argList" select=""/> |  | ||||||
|         <xsl:param name="asURL" select="false()"/> |  | ||||||
|         <xsl:variable name="nextArgs" select="substring-after($argList, ' -')"/> |  | ||||||
|         <xsl:variable name="argAndValue"> |  | ||||||
|             <xsl:choose> |  | ||||||
|                 <xsl:when test="$nextArgs"> |  | ||||||
|                     <xsl:value-of select="substring-before($argList, ' -')"/> |  | ||||||
|                 </xsl:when> |  | ||||||
|                 <xsl:otherwise><xsl:value-of select="$argList"/></xsl:otherwise> |  | ||||||
|             </xsl:choose> |  | ||||||
|         </xsl:variable> |  | ||||||
|  |  | ||||||
|         <xsl:choose> |  | ||||||
|             <xsl:when test="starts-with($argAndValue, '-')"> |  | ||||||
|                 <xsl:choose> |  | ||||||
|                     <xsl:when test="contains($argAndValue, ' ')"> |  | ||||||
|                         <xsl:call-template name="input"> |  | ||||||
|                             <xsl:with-param name="name" select="substring-before($argAndValue, ' ')"/> |  | ||||||
|                             <xsl:with-param name="value" select="substring-after($argAndValue, ' ')"/> |  | ||||||
|                             <xsl:with-param name="asURL" select="$asURL"/> |  | ||||||
|                         </xsl:call-template> |  | ||||||
|                     </xsl:when> |  | ||||||
|                     <xsl:otherwise> |  | ||||||
|                         <xsl:call-template name="input"> |  | ||||||
|                             <xsl:with-param name="name" select="$argAndValue"/> |  | ||||||
|                             <xsl:with-param name="value" select="on"/> |  | ||||||
|                             <xsl:with-param name="asURL" select="$asURL"/> |  | ||||||
|                         </xsl:call-template> |  | ||||||
|                     </xsl:otherwise> |  | ||||||
|                 </xsl:choose> |  | ||||||
|             </xsl:when> |  | ||||||
|             <xsl:otherwise> |  | ||||||
|                 <xsl:choose> |  | ||||||
|                     <xsl:when test="starts-with($argAndValue, 'P') or starts-with($argAndValue, 's') or starts-with($argAndValue, 'o')"> |  | ||||||
|                         <xsl:call-template name="input"> |  | ||||||
|                             <xsl:with-param name="name" select="substring($argAndValue, 1, 2)"/> |  | ||||||
|                             <xsl:with-param name="value" select="substring($argAndValue, 3)"/> |  | ||||||
|                             <xsl:with-param name="asURL" select="$asURL"/> |  | ||||||
|                         </xsl:call-template> |  | ||||||
|                     </xsl:when> |  | ||||||
|                     <xsl:otherwise> |  | ||||||
|                         <xsl:call-template name="input"> |  | ||||||
|                             <xsl:with-param name="name" select="substring($argAndValue, 1, 1)"/> |  | ||||||
|                             <xsl:with-param name="value" select="substring($argAndValue, 2)"/> |  | ||||||
|                             <xsl:with-param name="asURL" select="$asURL"/> |  | ||||||
|                         </xsl:call-template> |  | ||||||
|                     </xsl:otherwise> |  | ||||||
|                 </xsl:choose> |  | ||||||
|             </xsl:otherwise> |  | ||||||
|         </xsl:choose> |  | ||||||
|  |  | ||||||
|         <xsl:if test="$nextArgs"> |  | ||||||
|             <xsl:call-template name="optionsList"> |  | ||||||
|                 <xsl:with-param name="argList" select="$nextArgs"/> |  | ||||||
|                 <xsl:with-param name="asURL" select="$asURL"/> |  | ||||||
|             </xsl:call-template> |  | ||||||
|         </xsl:if> |  | ||||||
|     </xsl:template> |  | ||||||
|  |  | ||||||
|     <xsl:template name="input"> |  | ||||||
|         <xsl:param name="name"/> |  | ||||||
|         <xsl:param name="value" select=""/> |  | ||||||
|         <xsl:param name="asURL" select="false()"/> |  | ||||||
|         <xsl:choose> |  | ||||||
|             <xsl:when test="$asURL"> |  | ||||||
|                 <xsl:text>-</xsl:text> |  | ||||||
|                 <xsl:value-of select="$name"/> |  | ||||||
|                 <xsl:text>=</xsl:text> |  | ||||||
|                 <xsl:choose> |  | ||||||
|                     <xsl:when test="$value"><xsl:value-of select="$value"/></xsl:when> |  | ||||||
|                     <xsl:otherwise>on</xsl:otherwise> |  | ||||||
|                 </xsl:choose> |  | ||||||
|                 <xsl:text>&</xsl:text> |  | ||||||
|             </xsl:when> |  | ||||||
|             <xsl:otherwise> |  | ||||||
|                 <input type="hidden" name="-{$name}"> |  | ||||||
|                     <xsl:attribute name="value"> |  | ||||||
|                         <xsl:choose> |  | ||||||
|                             <xsl:when test="$value"><xsl:value-of select="$value"/></xsl:when> |  | ||||||
|                             <xsl:otherwise>on</xsl:otherwise> |  | ||||||
|                         </xsl:choose> |  | ||||||
|                     </xsl:attribute> |  | ||||||
|                 </input> |  | ||||||
|             </xsl:otherwise> |  | ||||||
|         </xsl:choose> |  | ||||||
|     </xsl:template> |  | ||||||
|  |  | ||||||
| </xsl:stylesheet> | </xsl:stylesheet> | ||||||
		Reference in New Issue
	
	Block a user