Ejemplo n.º 1
0
func main() {
	py := [][]string{}
	json.Unmarshal([]byte(pinyin.Json), &py)

	f, _ := os.Open("domains.txt")
	bytes, _ := ioutil.ReadAll(f)
	f.Close()

	domains := String(bytes).SplitLines()

	// names := []string{}
	nameset := map[string]bool{}

	target := 3000000
	perline := 30000
	index := 0

	names := []String{}

	for i := 0; i != target; i++ {
		name := ""
		for n := random.IntRange(1, 5); n > 0; {
			p := py[random.ChoiceIndex(py)][1]
			if len(p) > 4 {
				continue
			}

			name += p
			n--
		}

		name += Sprintf("%d%s", random.IntRange(1000, 100000), random.Choice(domains).(String))
		if nameset[name] {
			i--
			continue
		}

		nameset[name] = true
		names = append(names, String(name))

		switch {
		case i+1 == target,
			i != 0 && i%perline == 0:
			f, _ = os.Create(Sprintf("names%d.txt", index))
			f.WriteString("INSERT IGNORE INTO appstore_buydata_appleid (username) VALUES (\"")
			f.WriteString(string(String("\"),(\"").Join(names)))
			f.WriteString("\");\n")

			f.Close()

			index++
			names = []String{}
		}
	}
}
Ejemplo n.º 2
0
func openThread(session *http.Session, user String) {
	doc := openPage(session, FORUM_URL)

	threads := []*goquery.Selection{}

	doc.Find("tbody").Each(func(i int, s *goquery.Selection) {
		id_, exist := s.Attr("id")
		id := String(id_)
		if exist && id.StartsWith("normalthread_") {
			threads = append(threads, s)
		}
	})

	if len(threads) == 0 {
		Raise("empty thread")
	}

	index := random.IntRange(0, len(threads))
	t := threads[index].Find("a.s.xst")
	href, ok := t.Attr("href")

	if ok == false {
		Raise("can't find thread addr")
	}

	credit := String(doc.Find("#extcreditmenu").Text())
	console.SetTitle(credit.Split(":", 1)[1])

	Printf("[%s][%s] %s @ %s\n", time.Now().Format("2006-01-02 15:04:05"), user, credit, t.Text())

	session.Get(BASE_URL + href)
}