<commit_before>diff -Naur kamikaze-orig/package/tor/Makefile kamikaze-mod/package/tor/Makefile
--- kamikaze-orig/package/tor/Makefile	1970-01-01 00:00:00.000000000 +0000
+++ kamikaze-mod/package/tor/Makefile	2008-07-28 15:06:37.736975605 +0000
@@ -0,0 +1,113 @@
+#
+# Copyright (C) 2008 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# $Id: Makefile 11265 2008-05-25 13:45:00Z blogic $
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=tor
+#PKG_VERSION:=0.2.0.28-rc
+PKG_VERSION:=0.2.1.2-alpha
+
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.torproject.org/dist/
+#PKG_MD5SUM:=d65dd5c9e1f82912aa0c736c5daec22d
+PKG_MD5SUM:=122778603272fd3e53f6c2e7b6be4a81
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tor
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libevent +libopenssl +libpthread +zlib
+  TITLE:=An anonymous Internet communication system
+  URL:=http://tor.eff.org/
+endef
+
+define Package/tor/description
+ Tor is a toolset for a wide range of organizations and people that want to 
+ improve their safety and security on the Internet. Using Tor can help you 
+ anonymize web browsing and publishing, instant messaging, IRC, SSH, and 
+ more. Tor also provides a platform on which software developers can build 
+ new applications with built-in anonymity, safety, and privacy features.
+endef
+
+define Package/tor/conffiles
+/etc/tor/torrc
+endef
+
+define Package/tor/postinst
+#!/bin/sh
+
+name=tor
+id=52
+
+# do not change below
+# # check if we are on real system
+if [ -z "$${IPKG_INSTROOT}" ]; then
+        # create copies of passwd and group, if we use squashfs
+        rootfs=`mount |awk '/root/ { print $$5 }'`
+        if [ "$$rootfs" = "squashfs" ]; then
+                if [ -h /etc/group ]; then
+                        rm /etc/group
+                        cp /rom/etc/group /etc/group
+                fi
+                if [ -h /etc/passwd ]; then
+                        rm /etc/passwd
+                        cp /rom/etc/passwd /etc/passwd
+                fi
+        fi
+fi
+
+echo ""
+if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
+        echo "adding group $$name to /etc/group"
+        echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
+fi
+
+if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
+        echo "adding user $name to /etc/passwd"
+        echo "$${name}:x:$${id}:$${id}:$${name}:/tmp/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
+fi
+endef
+
+EXTRA_CFLAGS += -I$(LINUX_DIR)/include
+EXTRA_CPPFLAGS += -I$(LINUX_DIR)/include
+
+CONFIGURE_ARGS += \
+	--enable-eventdns \
+	--enable-transparent \
+	--enable-threads \
+	--with-libevent-dir="$(STAGING_DIR)/usr" \
+	--with-ssl-dir="$(STAGING_DIR)/usr" \
+
+CONFIGURE_VARS += \
+	CROSS_COMPILE="yes" \
+
+
+# pass CFLAGS again to override -O2 set by configure
+define Build/Compile
+	$(MAKE) -C $(PKG_BUILD_DIR) \
+		CFLAGS="$(TARGET_CFLAGS) -I$(LINUX_DIR)/include" \
+		DESTDIR="$(PKG_INSTALL_DIR)" \
+		all install
+endef
+
+define Package/tor/install
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/or/tor $(1)/usr/sbin/
+	$(INSTALL_DIR) $(1)/etc/init.d
+	$(INSTALL_BIN) ./files/tor.init $(1)/etc/init.d/tor
+	$(INSTALL_DIR) $(1)/etc/tor
+	$(INSTALL_DATA) ./files/torrc $(1)/etc/tor/torrc
+	$(INSTALL_DIR) $(1)/var/log/tor
+	$(INSTALL_DIR) $(1)/var/run/tor
+endef
+
+$(eval $(call BuildPackage,tor))
diff -Naur kamikaze-orig/package/tor/files/tor.init kamikaze-mod/package/tor/files/tor.init
--- kamikaze-orig/package/tor/files/tor.init	1970-01-01 00:00:00.000000000 +0000
+++ kamikaze-mod/package/tor/files/tor.init	2008-07-28 15:11:02.520282463 +0000
@@ -0,0 +1,86 @@
+#!/bin/sh 
+
+BIN=tor
+DEFAULT=/etc/default/$BIN
+HOME_D=/home/$BIN
+CONF_F=$HOME_D/torrc
+LOG_D=/var/log/$BIN
+SLOG_F=$LOG_D/start.log
+DATA_D=$HOME_D/data
+RUN_D=/var/run/$BIN
+PID_F=$RUN_D/$BIN.pid
+RUN_USER=$BIN
+RUN_GROUP=$BIN
+TOR_INTF=eth0
+grep eth1: /proc/net/dev >/dev/null 2>&1
+if [ $? -eq 0 ]; then
+  TOR_INTF=eth1
+fi
+MYIP=$(ifconfig $TOR_INTF | grep 'inet addr' | sed 's/.*inet addr://' | sed 's/ .*//')
+
+if [ "$1" = "start" ]; then
+	[ -f $DEFAULT ] && . $DEFAULT
+	[ -d $HOME_D ] || mkdir -p $HOME_D
+	[ ! -f $CONF_F ] && cp /etc/tor/torrc $CONF_F
+	[ -d $LOG_D ] || mkdir -p $LOG_D
+	chown $RUN_USER:$RUN_GROUP $LOG_D
+	[ -d $DATA_D ] || mkdir -p $DATA_D
+	chmod 700 $DATA_D
+	chown -R $RUN_USER:$RUN_GROUP $HOME_D
+	[ -d $RUN_D ] || mkdir -p $RUN_D
+	chown $RUN_USER:$RUN_GROUP $RUN_D
+	chmod 700 $RUN_D
+	$BIN -f $CONF_F $OPTIONS > $SLOG_F 2>&1
+	# forcibly filter some traffic which should never go over Tor:
+	# no SMTP
+	iptables -t nat -A PREROUTING -i $TOR_INTF -s ! $MYIP -p tcp --dport 25 -j DROP
+	# no TCP DNS
+	iptables -t nat -A PREROUTING -i $TOR_INTF -s ! $MYIP -p tcp --dport 53 -j DROP
+	# no NetBIOS
+	iptables -t nat -A PREROUTING -i $TOR_INTF -s ! $MYIP -p tcp --dport 137 -j DROP
+	iptables -t nat -A PREROUTING -i $TOR_INTF -s ! $MYIP -p tcp --dport 138 -j DROP
+	iptables -t nat -A PREROUTING -i $TOR_INTF -s ! $MYIP -p tcp --dport 139 -j DROP
+	# trans proxy TCP and DNS
+	iptables -t nat -A PREROUTING -i $TOR_INTF -s ! $MYIP -p tcp -j REDIRECT --to 9095
+	iptables -t nat -A PREROUTING -i $TOR_INTF -s ! $MYIP -p udp --dport 53 -j REDIRECT --to 9093
+	# drop everything else ...
+	iptables -t nat -A PREROUTING -i $TOR_INTF -s ! $MYIP -j DROP
+
+elif [ "$1" = "stop" ]; then
+	# XXX TODO: replace this with a fail-safe shutdown
+	iptables -F
+	iptables -t nat -F
+	[ -f $PID_F ] && kill $(cat $PID_F)
+
+elif [ "$1" = "restart" ]; then
+	$0 stop
+	$0 start
+
+elif [ "$1" = "status" ]; then
+	while true; do
+	  clear;echo
+	  date
+	  echo
+	  echo "TorVM IP Address: $MYIP"
+	  echo
+	  # check if we are fully bootstrapped yet
+	  grep 'Bootstrapped 100' /var/log/tor/notices.log >/dev/null 2>&1
+	  if [ "$?" -ne "0" ]; then
+	  	echo "Tor is still trying to bootstrap into the network..."
+		echo "Be sure the Tor VM clock is correct and that your traffic"
+		echo " is not getting filtered upstream."
+		echo
+	  	grep Bootstrapped /var/log/tor/notices.log | sed 's/.*Bootstrapped/Bootstrapped/' | tail -6
+	  else<commit_msg>Keep Tor trademark stewards happy.<commit_after>diff -Naur kamikaze-orig/package/tor/Makefile kamikaze-mod/package/tor/Makefile
--- kamikaze-orig/package/tor/Makefile	1970-01-01 00:00:00.000000000 +0000
+++ kamikaze-mod/package/tor/Makefile	2008-07-28 15:06:37.736975605 +0000
@@ -0,0 +1,113 @@
+#
+# Copyright (C) 2008 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+# $Id: Makefile 11265 2008-05-25 13:45:00Z blogic $
+
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/kernel.mk
+
+PKG_NAME:=tor
+#PKG_VERSION:=0.2.0.28-rc
+PKG_VERSION:=0.2.1.2-alpha
+
+PKG_RELEASE:=1
+
+PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
+PKG_SOURCE_URL:=http://www.torproject.org/dist/
+#PKG_MD5SUM:=d65dd5c9e1f82912aa0c736c5daec22d
+PKG_MD5SUM:=122778603272fd3e53f6c2e7b6be4a81
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/tor
+  SECTION:=net
+  CATEGORY:=Network
+  DEPENDS:=+libevent +libopenssl +libpthread +zlib
+  TITLE:=An anonymous Internet communication system
+  URL:=http://tor.eff.org/
+endef
+
+define Package/tor/description
+ Tor is a toolset for a wide range of organizations and people that want to 
+ improve their safety and security on the Internet. Using Tor can help you 
+ anonymize web browsing and publishing, instant messaging, IRC, SSH, and 
+ more. Tor also provides a platform on which software developers can build 
+ new applications with built-in anonymity, safety, and privacy features.
+endef
+
+define Package/tor/conffiles
+/etc/tor/torrc
+endef
+
+define Package/tor/postinst
+#!/bin/sh
+
+name=tor
+id=52
+
+# do not change below
+# # check if we are on real system
+if [ -z "$${IPKG_INSTROOT}" ]; then
+        # create copies of passwd and group, if we use squashfs
+        rootfs=`mount |awk '/root/ { print $$5 }'`
+        if [ "$$rootfs" = "squashfs" ]; then
+                if [ -h /etc/group ]; then
+                        rm /etc/group
+                        cp /rom/etc/group /etc/group
+                fi
+                if [ -h /etc/passwd ]; then
+                        rm /etc/passwd
+                        cp /rom/etc/passwd /etc/passwd
+                fi
+        fi
+fi
+
+echo ""
+if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/group)" ]; then
+        echo "adding group $$name to /etc/group"
+        echo "$${name}:x:$${id}:" >> $${IPKG_INSTROOT}/etc/group
+fi
+
+if [ -z "$$(grep ^\\$${name}: $${IPKG_INSTROOT}/etc/passwd)" ]; then
+        echo "adding user $name to /etc/passwd"
+        echo "$${name}:x:$${id}:$${id}:$${name}:/tmp/.$${name}:/bin/false" >> $${IPKG_INSTROOT}/etc/passwd
+fi
+endef
+
+EXTRA_CFLAGS += -I$(LINUX_DIR)/include
+EXTRA_CPPFLAGS += -I$(LINUX_DIR)/include
+
+CONFIGURE_ARGS += \
+	--enable-eventdns \
+	--enable-transparent \
+	--enable-threads \
+	--with-libevent-dir="$(STAGING_DIR)/usr" \
+	--with-ssl-dir="$(STAGING_DIR)/usr" \
+
+CONFIGURE_VARS += \
+	CROSS_COMPILE="yes" \
+
+
+# pass CFLAGS again to override -O2 set by configure
+define Build/Compile
+	$(MAKE) -C $(PKG_BUILD_DIR) \
+		CFLAGS="$(TARGET_CFLAGS) -I$(LINUX_DIR)/include" \
+		DESTDIR="$(PKG_INSTALL_DIR)" \
+		all install
+endef
+
+define Package/tor/install
+	$(INSTALL_DIR) $(1)/usr/sbin
+	$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/or/tor $(1)/usr/sbin/
+	$(INSTALL_DIR) $(1)/etc/init.d
+	$(INSTALL_BIN) ./files/tor.init $(1)/etc/init.d/tor
+	$(INSTALL_DIR) $(1)/etc/tor
+	$(INSTALL_DATA) ./files/torrc $(1)/etc/tor/torrc
+	$(INSTALL_DIR) $(1)/var/log/tor
+	$(INSTALL_DIR) $(1)/var/run/tor
+endef
+
+$(eval $(call BuildPackage,tor))
diff -Naur kamikaze-orig/package/tor/files/tor.init kamikaze-mod/package/tor/files/tor.init
--- kamikaze-orig/package/tor/files/tor.init	1970-01-01 00:00:00.000000000 +0000
+++ kamikaze-mod/package/tor/files/tor.init	2008-07-28 15:11:02.520282463 +0000
@@ -0,0 +1,86 @@
+#!/bin/sh 
+
+BIN=tor
+DEFAULT=/etc/default/$BIN
+HOME_D=/home/$BIN
+CONF_F=$HOME_D/torrc
+LOG_D=/var/log/$BIN
+SLOG_F=$LOG_D/start.log
+DATA_D=$HOME_D/data
+RUN_D=/var/run/$BIN
+PID_F=$RUN_D/$BIN.pid
+RUN_USER=$BIN
+RUN_GROUP=$BIN
+TOR_INTF=eth0
+grep eth1: /proc/net/dev >/dev/null 2>&1
+if [ $? -eq 0 ]; then
+  TOR_INTF=eth1
+fi
+MYIP=$(ifconfig $TOR_INTF | grep 'inet addr' | sed 's/.*inet addr://' | sed 's/ .*//')
+
+if [ "$1" = "start" ]; then
+	[ -f $DEFAULT ] && . $DEFAULT
+	[ -d $HOME_D ] || mkdir -p $HOME_D
+	[ ! -f $CONF_F ] && cp /etc/tor/torrc $CONF_F
+	[ -d $LOG_D ] || mkdir -p $LOG_D
+	chown $RUN_USER:$RUN_GROUP $LOG_D
+	[ -d $DATA_D ] || mkdir -p $DATA_D
+	chmod 700 $DATA_D
+	chown -R $RUN_USER:$RUN_GROUP $HOME_D
+	[ -d $RUN_D ] || mkdir -p $RUN_D
+	chown $RUN_USER:$RUN_GROUP $RUN_D
+	chmod 700 $RUN_D
+	$BIN -f $CONF_F $OPTIONS > $SLOG_F 2>&1
+	# forcibly filter some traffic which should never go over Tor:
+	# no SMTP
+	iptables -t nat -A PREROUTING -i $TOR_INTF -s ! $MYIP -p tcp --dport 25 -j DROP
+	# no TCP DNS
+	iptables -t nat -A PREROUTING -i $TOR_INTF -s ! $MYIP -p tcp --dport 53 -j DROP
+	# no NetBIOS
+	iptables -t nat -A PREROUTING -i $TOR_INTF -s ! $MYIP -p tcp --dport 137 -j DROP
+	iptables -t nat -A PREROUTING -i $TOR_INTF -s ! $MYIP -p tcp --dport 138 -j DROP
+	iptables -t nat -A PREROUTING -i $TOR_INTF -s ! $MYIP -p tcp --dport 139 -j DROP
+	# trans proxy TCP and DNS
+	iptables -t nat -A PREROUTING -i $TOR_INTF -s ! $MYIP -p tcp -j REDIRECT --to 9095
+	iptables -t nat -A PREROUTING -i $TOR_INTF -s ! $MYIP -p udp --dport 53 -j REDIRECT --to 9093
+	# drop everything else ...
+	iptables -t nat -A PREROUTING -i $TOR_INTF -s ! $MYIP -j DROP
+
+elif [ "$1" = "stop" ]; then
+	# XXX TODO: replace this with a fail-safe shutdown
+	iptables -F
+	iptables -t nat -F
+	[ -f $PID_F ] && kill $(cat $PID_F)
+
+elif [ "$1" = "restart" ]; then
+	$0 stop
+	$0 start
+
+elif [ "$1" = "status" ]; then
+	while true; do
+	  clear;echo
+	  date
+	  echo
+	  echo "Tor VM local network IP address: $MYIP"
+	  echo
+	  # check if we are fully bootstrapped yet
+	  grep 'Bootstrapped 100' /var/log/tor/notices.log >/dev/null 2>&1
+	  if [ "$?" -ne "0" ]; then
+	  	echo "Tor is still trying to bootstrap into the network..."
+		echo "Be sure the Tor VM clock is correct and that your traffic"
+		echo " is not getting filtered upstream."
+		echo
+	  	grep Bootstrapped /var/log/tor/notices.log | sed 's/.*Bootstrapped/Bootstrapped/' | tail -6
+	  else
{'fraction_non_alphanumeric': 0.18050284629981025, 'fraction_numerical': 0.04048070841239722, 'mean_word_length': 3.2205538872205537, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 4, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2886667', 'n_tokens_mistral': 5682, 'n_tokens_neox': 5251, 'n_words': 1276}