source: pwntcha/testsuite/makehtml.sh @ 474

Last change on this file since 474 was 474, checked in by Sam Hocevar, 18 years ago
  • better script
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 1.3 KB
Line 
1#!/bin/sh
2
3rm -f index.html && echo > index.html
4echo '<html><body bgcolor="#aaddff"><h1>CAPTCHA samples</h1><table>' >> index.html
5
6find -maxdepth 2 -name '*_000.*' | cut -b3- | sed 's,/[^.]*., ,' | sort | uniq | while read DIRNAME EXTENSION; do
7  echo -n "${DIRNAME}"
8  INDEX="${DIRNAME}.html"
9  rm -f "${INDEX}" && echo > "${INDEX}"
10  echo '<html><body bgcolor="#aaddff"><table>' >> "${INDEX}"
11  N=0
12  for x in `seq -w 0 999`; do
13    if [ ! -f "${DIRNAME}/${DIRNAME}_$x.${EXTENSION}" ]; then
14        break
15    fi
16    echo '<tr>' >> "${INDEX}"
17    echo '<td><h1><tt>#'"$x"'</tt></h1></td>' >> "${INDEX}"
18    echo '<td><img src="'"${DIRNAME}/${DIRNAME}_$x.${EXTENSION}"'" /></td>' >> "${INDEX}"
19    TEXT="[untranslated]"
20    N=$((${N} + 1))
21    if [ -r "${DIRNAME}/control.txt" ]; then
22        TEXT="`sed -ne ${N}p "${DIRNAME}/control.txt"`"
23    fi
24    echo '<td><h1><tt>'"$TEXT"'</tt></h1></td>' >> "${INDEX}"
25    echo '</tr>' >> "${INDEX}"
26  done
27  echo " - ${N} images"
28  echo '</table></body></html>' >> "${INDEX}"
29
30  convert "${DIRNAME}/${DIRNAME}_000.${EXTENSION}" -geometry '150x50>' "${DIRNAME}.jpeg"
31  echo '<tr><td align="right"><a href="'"${INDEX}"'"><img align="middle" src="'"${DIRNAME}"'.jpeg"></a></td><td><h2>'"${DIRNAME} (${N})"'</h2></td></tr>' >> index.html
32done
33
34echo '</table></body></html>' >> index.html
35
Note: See TracBrowser for help on using the repository browser.