github.com/masterhung0112/hk_server/v5@v5.0.0-20220302090640-ec71aef15e1c/utils/textgeneration.go (about) 1 package utils 2 3 import ( 4 "math/rand" 5 "strings" 6 ) 7 8 const ( 9 ALPHANUMERIC = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890" 10 LOWERCASE = "abcdefghijklmnopqrstuvwxyz" 11 ) 12 13 // Strings that should pass as acceptable posts 14 var FuzzyStringsPosts = []string{ 15 `**[1] - [Markdown Tests]** 16 _italics_ 17 more _italics_ 18 **bold** 19 more **bold** 20 **_bold-italic_** 21 more **_bold-italic_*8 22 ~~strikethrough~~ 23 more ~~strikethrough~~ 24 ` + "```" + ` 25 multi-line code block<enter here> 26 multi-line code block 27 emoji that should not render in code block: :ice_cream: 28 ` + "```" + ` 29 ` + "`monospace`" + ` 30 [Link to Mattermost](www.mattermost.com) 31 Inline Image with link, alt text, and hover text: ](https://travis-ci.org/mattermost/hk_server) 32 33 Three types of lines: 34 *** 35 ___ 36 --- 37 `, 38 39 ` **[2] - **[More Markdown Tests]** 40 > i am a blockquote! 41 42 > i am a 2nd multiline 43 > quote. 44 i am text right after a multiline quote, but not in the quote 45 46 * list item 47 * another list item 48 * indented list item 49 50 1. numbered list, item number 1 51 2. item number two 52 53 `, 54 55 ` **[3]** - **[More Markdown Tests]** 56 57 Table 58 59 | Left-Aligned | Center Aligned | Right Aligned | 60 | :------------ |:---------------:| -----:| 61 | Left column 1 | this text | $100 | 62 | Left column 2 | is | $10 | 63 | Left column 3 | centered | $1 | 64 65 Ugly table 66 67 Markdown | Less | Pretty 68 --- | --- | --- 69 *Still* | ~~renders~~ | **nicely** 70 1 | 2 | 3 71 72 # Large heading 73 ## Smaller heading 74 ### Even smaller heading 75 # Large heading 76 ## Smaller heading 77 ### Even smaller heading 78 79 `, 80 81 ` **[4]** - **[More Markdown Tests]** 82 # This is a heading 83 84 I am a multiline 85 text. 86 87 #### I am a level four heading 88 89 ` + "```tex" + ` 90 f(x) = \int_{-\infty}^\infty 91 \hat f(\xi)\,e^{2 \pi i \xi x} 92 \,d\xi 93 ` + "```" + ` 94 * This was some tex code* 95 `, 96 97 `**[5]** - **[Markdown and automatic preview of content test]** 98 99 ## This should display a preview for the given vine url 100 101 Some text *before* the link 102 And a smiley :) 103 https://vine.co/v/eDeVgbFrt9L 104 105 Some more text here 106 and here 107 and even more here 108 `, 109 110 `**[6]** - **[More markdown and automatic preview of content test]** 111 112 ## Only the first given url should render an "attachment" 113 114 Lets also add a table here, because why not 115 | Left-Aligned | Center Aligned | Right Aligned | 116 | :------------ |:---------------:| -----:| 117 | Left column 1 | this text | $100 | 118 | Left column 2 | is | $10 | 119 | Left column 3 | centered | $1 | 120 121 Wiki should render: 122 http://en.wikipedia.org/wiki/Foo 123 https://vine.co/v/eDeVgbFrt9L 124 `, 125 126 `**[7] [Image Test]** 127 128 ## this *should* display an image 129 130 http://37.media.tumblr.com/tumblr_mavsumGGAd1qboaw8o1_500.jpg 131 `, 132 133 /* `**[2] [Username Linking Test]** 134 I saw @alice--and I said "Hi @alice!" then "What's up @alice?" and then @alice, was totally @alice; she just "@alice"'d me and walked on by. That's @alice... 135 @alice‽‽ 136 `, 137 138 `**[3] [Mention Highlighting Test]** 139 `,*/ 140 141 `**[8] [Emoji Display Test 1]** 142 :+1: :-1: :100: :1234: :8ball: :a: :ab: :abc: :abcd: :accept: 143 :aerial_tramway: :airplane: :alarm_clock: :ambulance: :anchor: :angel: :anger: :angry: :anguished: :ant: 144 :apple: :aquarius: :aries: :arrow_backward: :arrow_double_down: :arrow_double_up: :arrow_down: :arrow_down_small: :arrow_forward: :arrow_heading_down: 145 :arrow_heading_up: :arrow_left: :arrow_lower_left: :arrow_lower_right: :arrow_right: :arrow_right_hook: :arrow_up: :arrow_up_down: 146 :arrow_upper_left: :arrow_upper_right: :arrows_clockwise: :arrows_counterclockwise: :art: :articulated_lorry: :astonished: :atm: :arrow_up_small: :b: 147 :baby: :baby_bottle: :baby_chick: :baby_symbol: :back: :baggage_claim: :balloon: :ballot_box_with_check: :bamboo: :banana: 148 :bangbang: :bank: :bar_chart: :barber: :baseball: :basketball: :bath: :bathtub: :battery: :bear: 149 :bee: :beer: :beers: :beetle: :beginner: :bell: :bento: :bicyclist: :bike: :bikini: 150 :bird: :birthday: :black_circle: :black_joker: :black_medium_small_square: :black_medium_square: :black_nib: :black_small_square: :black_square: :black_square_button: 151 :blossom: :blowfish: :blue_book: :blue_car: :blue_heart: :blush: :boar: :boat: :bomb: :book: 152 :bookmark: :bookmark_tabs: :books: :boom: :boot: :bouquet: :bow: :bowling: :bowtie: :boy: 153 :bread: :bride_with_veil: :bridge_at_night: :briefcase: :broken_heart: :bug: :bulb: :bullettrain_front: :bullettrain_side: :bus: 154 :busstop: :bust_in_silhouette: :busts_in_silhouette: :cactus: :cake: :calendar: :calling: :camel: :camera: :cancer: 155 :candy: :capital_abcd: :capricorn: :car: :card_index: :carousel_horse: :cat: :cat2: :cd: :chart: 156 :chart_with_downwards_trend: :chart_with_upwards_trend: :checkered_flag: :cherries: :cherry_blossom: :chestnut: :chicken: :children_crossing: :chocolate_bar: :christmas_tree: 157 :church: :cinema: :circus_tent: :city_sunrise: :city_sunset: :cl: :clap: :clapper: :clipboard: :clock1: 158 :clock10: :clock1030: :clock11: :clock1130: :clock12: :clock1230: :clock130: :clock2: :clock230: :clock3: 159 :clock330: :clock4: :clock430: :clock5: :clock530: :clock6: :clock630: :clock7: :clock730: :clock8: 160 :clock830: :clock9: :clock930: :closed_book: :closed_lock_with_key: :closed_umbrella: :cloud: :clubs: :cn: :cocktail: 161 :coffee: :cold_sweat: :collision: :computer: :confetti_ball: :confounded: :confused: :congratulations: :construction: :construction_worker: 162 :convenience_store: :cookie: :cool: :cop: :copyright: :corn: :couple: :couple_with_heart: :couplekiss: :cow: 163 :cow2: :credit_card: :crescent_moon: :crocodile: :crossed_flags: :crown: :cry: :crying_cat_face: :crystal_ball: :cupid: 164 :curly_loop: :currency_exchange: :curry: :custard: :customs: :cyclone: :dancer: :dancers: :dango: :dart: 165 :dash: :date: :de: :deciduous_tree: :department_store: :diamond_shape_with_a_dot_inside: :diamonds: :disappointed: :disappointed_relieved: :dizzy: 166 :dizzy_face: :do_not_litter: :dog: :dog2: :dollar: :dolls: :dolphin: :donut: :door: :doughnut: 167 :dragon: :dragon_face: :dress: :dromedary_camel: :droplet: :dvd: :e-mail: :ear: :ear_of_rice: :earth_africa: 168 :earth_americas: :earth_asia: :egg: :eggplant: :eight: :eight_pointed_black_star: :eight_spoked_asterisk: :electric_plug: :elephant: :email: 169 :end: :envelope: :es: :euro: :european_castle: :european_post_office: :evergreen_tree: :exclamation: :expressionless: :eyeglasses: 170 :eyes: :facepunch: :factory: :fallen_leaf: :family: :fast_forward: :fax: :fearful: :feelsgood: :feet: 171 :ferris_wheel: :file_folder: :finnadie: :fire: :fire_engine: :fireworks: :first_quarter_moon: :first_quarter_moon_with_face: :fish: :fish_cake: 172 :fishing_pole_and_fish: :fist: :five: :flags: :flashlight: :floppy_disk: :flower_playing_cards: :flushed: :foggy: :football: 173 :fork_and_knife: :fountain: :four: :four_leaf_clover: :fr: :free: :fried_shrimp: :fries: :frog: :frowning: 174 :fu: :fuelpump: :full_moon: :full_moon_with_face: :game_die: :gb: :gem: :gemini: :ghost: :gift:`, 175 176 `**[9] [Emoji Display Test 2]** 177 :gift_heart: :girl: :globe_with_meridians: :goat: :goberserk: :godmode: :golf: :grapes: :green_apple: :green_book: 178 :green_heart: :grey_exclamation: :grey_question: :grimacing: :grin: :grinning: :guardsman: :guitar: :gun: :haircut: 179 :hamburger: :hammer: :hamster: :hand: :handbag: :hankey: :hash: :hatched_chick: :hatching_chick: :headphones: 180 :hear_no_evil: :heart: :heart_decoration: :heart_eyes: :heart_eyes_cat: :heartbeat: :heartpulse: :hearts: :heavy_check_mark: :heavy_division_sign: 181 :heavy_dollar_sign: :heavy_exclamation_mark: :heavy_minus_sign: :heavy_multiplication_x: :heavy_plus_sign: :helicopter: :herb: :hibiscus: :high_brightness: :high_heel: 182 :hocho: :honey_pot: :honeybee: :horse: :horse_racing: :hospital: :hotel: :hotsprings: :hourglass: :hourglass_flowing_sand: 183 :house: :house_with_garden: :hurtrealbad: :hushed: :ice_cream: :icecream: :id: :ideograph_advantage: :imp: :inbox_tray: 184 :incoming_envelope: :information_desk_person: :information_source: :innocent: :interrobang: :iphone: :it: :izakaya_lantern: :jack_o_lantern: 185 :japan: :japanese_castle: :japanese_goblin: :japanese_ogre: :jeans: :joy: :joy_cat: :jp: :key: :keycap_ten: 186 :kimono: :kiss: :kissing: :kissing_cat: :kissing_closed_eyes: :kissing_face: :kissing_heart: :kissing_smiling_eyes: :koala: :koko: 187 :kr: :large_blue_circle: :large_blue_diamond: :large_orange_diamond: :last_quarter_moon: :last_quarter_moon_with_face: :laughing: :leaves: :ledger: :left_luggage: 188 :left_right_arrow: :leftwards_arrow_with_hook: :lemon: :leo: :leopard: :libra: :light_rail: :link: :lips: :lipstick: 189 :lock: :lock_with_ink_pen: :lollipop: :loop: :loudspeaker: :love_hotel: :love_letter: :low_brightness: :m: :mag: 190 :mag_right: :mahjong: :mailbox: :mailbox_closed: :mailbox_with_mail: :mailbox_with_no_mail: :man: :man_with_gua_pi_mao: :man_with_turban: :mans_shoe: 191 :maple_leaf: :mask: :massage: :meat_on_bone: :mega: :melon: :memo: :mens: :metal: :metro: 192 :microphone: :microscope: :milky_way: :minibus: :minidisc: :mobile_phone_off: :money_with_wings: :moneybag: :monkey: :monkey_face: 193 :monorail: :mortar_board: :mount_fuji: :mountain_bicyclist: :mountain_cableway: :mountain_railway: :mouse: :mouse2: :movie_camera: :moyai: 194 :muscle: :mushroom: :musical_keyboard: :musical_note: :musical_score: :mute: :nail_care: :name_badge: :neckbeard: :necktie: 195 :negative_squared_cross_mark: :neutral_face: :new: :new_moon: :new_moon_with_face: :newspaper: :ng: :nine: :no_bell: 196 :no_bicycles: :no_entry: :no_entry_sign: :no_good: :no_mobile_phones: :no_mouth: :no_pedestrians: :no_smoking: :non-potable_water: :nose: 197 :notebook: :notebook_with_decorative_cover: :notes: :nut_and_bolt: :o: :o2: :ocean: :octocat: :octopus: :oden: 198 :office: :ok: :ok_hand: :ok_woman: :older_man: :older_woman: :on: :oncoming_automobile: :oncoming_bus: :oncoming_police_car: 199 :oncoming_taxi: :one: :open_file_folder: :open_hands: :open_mouth: :ophiuchus: :orange_book: :outbox_tray: :ox: :package: 200 :page_facing_up: :page_with_curl: :pager: :palm_tree: :panda_face: :paperclip: :parking: :part_alternation_mark: :partly_sunny: :passport_control: 201 :paw_prints: :peach: :pear: :pencil: :pencil2: :penguin: :pensive: :performing_arts: :persevere: :person_frowning: 202 :person_with_blond_hair: :person_with_pouting_face: :phone: :pig: :pig2: :pig_nose: :pill: :pineapple: :pisces: :pizza: 203 `, 204 205 `**[10] [Emoji Display Test 3]** 206 :plus1: :point_down: :point_left: :point_right: :point_up: :point_up_2: :police_car: :poodle: :poop: :post_office: 207 :postal_horn: :postbox: :potable_water: :pouch: :poultry_leg: :pound: :pouting_cat: :pray: :princess: :punch: 208 :purple_heart: :purse: :pushpin: :put_litter_in_its_place: :question: :rabbit: :rabbit2: :racehorse: :radio: :radio_button: 209 :rage: :rage1: :rage2: :rage3: :rage4: :railway_car: :rainbow: :raised_hand: :raised_hands: :raising_hand: 210 :ram: :ramen: :rat: :recycle: :red_car: :red_circle: :registered: :relaxed: :relieved: :repeat: 211 :repeat_one: :restroom: :revolving_hearts: :rewind: :ribbon: :rice: :rice_ball: :rice_cracker: :rice_scene: :ring: 212 :rocket: :roller_coaster: :rooster: :rose: :rotating_light: :round_pushpin: :rowboat: :ru: 213 :rugby_football: :runner: :running: :running_shirt_with_sash: :sa: :sagittarius: :sailboat: :sake: :sandal: :santa: 214 :satellite: :satisfied: :saxophone: :school: :school_satchel: :scissors: :scorpius: :scream: :scream_cat: :scroll: 215 :seat: :secret: :see_no_evil: :seedling: :seven: :shaved_ice: :sheep: :shell: :ship: :shipit: 216 :shirt: :shit: :shoe: :shower: :signal_strength: :six: :six_pointed_star: :ski: :skull: :sleeping: 217 :sleepy: :slot_machine: :small_blue_diamond: :small_orange_diamond: :small_red_triangle: :small_red_triangle_down: :smile: :smile_cat: :smiley: :smiley_cat: 218 :smiling_imp: :smirk: :smirk_cat: :smoking: :snail: :snake: :snowboarder: :snowflake: :snowman: :sob: 219 :soccer: :soon: :sos: :sound: :space_invader: :spades: :spaghetti: :sparkle: :sparkler: :sparkles: 220 :sparkling_heart: :speak_no_evil: :speaker: :speech_balloon: :speedboat: :squirrel: :star: :star2: :stars: :station: 221 :statue_of_liberty: :steam_locomotive: :stew: :straight_ruler: :strawberry: :stuck_out_tongue: :stuck_out_tongue_closed_eyes: :stuck_out_tongue_winking_eye: :sun_with_face: :sunflower: 222 :sunglasses: :sunny: :sunrise: :sunrise_over_mountains: :surfer: :sushi: :suspect: :suspension_railway: :sweat: :sweat_drops: 223 :sweat_smile: :sweet_potato: :swimmer: :symbols: :syringe: :tada: :tanabata_tree: :tangerine: :taurus: :taxi: 224 :tea: :telephone: :telephone_receiver: :telescope: :tennis: :tent: :thought_balloon: :three: :thumbsdown: :thumbsup: 225 :ticket: :tiger: :tiger2: :tired_face: :tm: :toilet: :tokyo_tower: :tomato: :tongue: :top: 226 :tophat: :tractor: :traffic_light: :train: :train2: :tram: :triangular_flag_on_post: :triangular_ruler: :trident: :triumph: 227 :trolleybus: :trollface: :trophy: :tropical_drink: :tropical_fish: :truck: :trumpet: :tshirt: :tulip: :turtle: 228 :tv: :twisted_rightwards_arrows: :two: :two_hearts: :two_men_holding_hands: :two_women_holding_hands: 229 :uk: :umbrella: :unamused: :underage: :unlock: :up: :us: :v: :vertical_traffic_light: :vhs: 230 :vibration_mode: :video_camera: :video_game: :violin: :virgo: :volcano: :vs: :walking: :waning_crescent_moon: :waning_gibbous_moon: 231 :warning: :watch: :water_buffalo: :watermelon: :wave: :wavy_dash: :waxing_crescent_moon: :waxing_gibbous_moon: :wc: :weary: 232 :wedding: :whale: :whale2: :wheelchair: :white_check_mark: :white_circle: :white_flower: :white_large_square: :white_medium_small_square: :white_medium_square: 233 :white_small_square: :white_square_button: :wind_chime: :wine_glass: :wink: :wolf: :woman: :womans_clothes: :womans_hat: :womens: 234 :worried: :wrench: :x: :yellow_heart: :yen: :yum: :zap: :zero: :zzz: 235 Unnamed: :u5272: :u5408: :u55b6: :u6307: :u6708: :u6709: :u6e80: :u7121: :u7533: :u7981: :u7a7a: 236 `, 237 238 `**[11] [Auto Linking]** 239 #### should be turned into links: 240 http://example.com 241 https://example.com 242 www.example.com 243 www.example.com/index 244 www.example.com/index.html 245 www.example.com/index/sub 246 www.example.com/index?params=1 247 www.example.com/index?params=1&other=2 248 www.example.com/index?params=1;other=2 249 http://example.com:8065 250 <http://example.com> 251 <www.example.com> 252 http://www.example.com/_/page 253 www.example.com/_/page 254 https://en.wikipedia.org/wiki/🐬 255 https://en.wikipedia.org/wiki/Rendering_(computer_graphics) 256 http://127.0.0.1 257 http://192.168.1.1:4040 258 http://[::1]:80 259 http://[::1]:8065 260 https://[::1]:80 261 http://[2001:0:5ef5:79fb:303a:62d5:3312:ff42]:80 262 http://[2001:0:5ef5:79fb:303a:62d5:3312:ff42]:8065 263 https://[2001:0:5ef5:79fb:303a:62d5:3312:ff42]:443 264 http://username:password@example.com 265 http://username:password@127.0.0.1 266 http://username:password@[2001:0:5ef5:79fb:303a:62d5:3312:ff42]:80 267 test@example.com 268 269 #### should be turned into links which link to the correct place: 270 [example link](example.com) links to ` + "`" + `http://example.com` + "`" + ` 271 [example.com](example.com) links to ` + "`" + `http://example.com` + "`" + ` 272 [example.com/other](example.com) links to ` + "`" + `http://example.com` + "`" + ` 273 [example.com/other_link](example.com/example) links to ` + "`" + `http://example.com/example` + "`" + ` 274 www.example.com links to ` + "`" + `http://www.example.com` + "`" + ` 275 https://example.com links to ` + "`" + `https://example.com` + "`" + `and not ` + "`" + `http://example.com` + "`" + ` 276 https://en.wikipedia.org/wiki/🐬 links to the Wikipedia article on dolphins 277 https://en.wikipedia.org/wiki/URLs#Syntax links to the Syntax section of the Wikipedia article on URLs 278 test@example.com links to ` + "`" + `mailto:test@example.com` + "`" + ` 279 [email link](mailto:test@example.com) links to ` + "`" + `mailto:test@example.com` + "`" + `and not ` + "`" + `http://mailto:test@example.com` + "`" + ` 280 [other link](ts3server://example.com) links to ` + "`" + `ts3server://example.com` + "`" + `and not ` + "`" + `http://ts3server://example.com` + "`" + ` 281 282 #### should not be turned into links: 283 example.com 284 readme.md 285 <example.com> 286 http:// 287 @example.com 288 289 #### should only turn the actual link into a link and not change surrounding text 290 (http://example.com) 291 (test@example.com) 292 This is a sentence with a http://example.com in it. 293 This is a sentence with a [link](http://example.com) in it. 294 This is a sentence with a http://example.com/_/underscore in it. 295 This is a sentence with a link (http://example.com) in it. 296 This is a sentence with a (https://en.wikipedia.org/wiki/Rendering_(computer_graphics)) in it. 297 This is a sentence with a http://192.168.1.1:4040 in it. 298 This is a sentence with a https://::1 in it. 299 This is a link to http://example.com. 300 `, 301 302 "*", "?", ".", "}{][)(><", "{}[]()<>", 303 304 "qahwah ( قهوة)", 305 "שָׁלוֹם עֲלֵיכֶם", 306 "Ramen チャーシュー chāshū", 307 "言而无信", 308 "Ṫ͌ó̍ ̍͂̓̍̍̀i̊ͯ͒", 309 "& < &qu", 310 311 "' or '1'='1' -- ", 312 "' or '1'='1' ({ ", 313 "' or '1'='1' /* ", 314 "1;DROP TABLE users", 315 316 "<b><i><u><strong><em>", 317 318 "sue@thatmightbe", 319 "sue@thatmightbe.", 320 "sue@thatmightbe.c", 321 "sue@thatmightbe.co", 322 "su+san@thatmightbe.com", 323 "a@b.中国", 324 "1@2.am", 325 "a@b.co.uk", 326 "a@b.cancerresearch", 327 "local@[127.0.0.1]", 328 329 "!@$%^&:*.,/|;'\"+=?`~#", 330 "'\"/\\\"\"''\\/", 331 "gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg", 332 "gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg", 333 "ą ć ę ł ń ó ś ź ż č ď ě ň ř š ť ž ă î ø å æ á é í ó ú Ç Ğ İ Ö Ş Ü", 334 "abcdefghijklmnopqrstuvwrxyz0123456789 -_", 335 "Ṫ͌ó̍ ̍͂̓̍̍̀i̊ͯ͒nͧ̍̓̃͋vok̂̓ͤ̓̂ěͬ ͆tͬ̐́̐͆h̒̏͌̓e͂ ̎̊h̽͆ͯ̄ͮi͊̂ͧͫ̇̃vͥͦ́ẻͤ-͒m̈́̀i̓ͮ͗̑͌̆̅n̓̓ͨd̊̑͛̔̚ ͨͮ̊̾rͪeͭͭ͑ͧ́͋p̈́̅̚rͧe̒̈̌s̍̽ͩ̓̇e͗n̏͊ͬͭtͨ͆ͤ̚iͪ͗̍n͐͒g̾ͦ̎ ͥ͌̽̊ͩͥ͗c̀ͬͣha̍̏̉ͪ̈̚o̊̏s̊̋̀̏̽̚.͒ͫ͛͛̎ͥ", 336 "H҉̵̞̟̠̖̗̘Ȅ̐̑̒̚̕̚ IS C̒̓̔̿̿̿̕̚̚̕̚̕̚̕̚̕̚̕̚OMI҉̵̞̟̠̖̗̘NG > ͡҉҉ ̵̡̢̛̗̘̙̜̝̞̟̠͇̊̋̌̍̎̏̿̿̿̚ ҉ ҉҉̡̢̡̢̛̛̖̗̘̙̜̝̞̟̠̖̗̘̙̜̝̞̟̠̊̋̌̍̎̏̐̑̒̓̔̊̋̌̍̎̏̐̑ ͡҉҉", 337 338 "<a href=\"//www.google.com\">Teh Googles</a>", 339 "<img src=\"//upload.wikimedia.org/wikipedia/meta/b/be/Wikipedia-logo-v2_2x.png\" />", 340 "& < " '", 341 " %21 %23 %24 %26 %27 %28 %29 %2A %2B %2C %2F %3A %3B %3D %3F %40 %5B %5D %0D %0A %0D%0A %20 %22 %25 %2D %2E %3C %3E %5C %5E %5F %60 %7B %7C %7D %7E", 342 343 ";alert('Well this is awkward.');", 344 "<script type='text/javascript'>alert('yay puppies');</script>", 345 346 "http?q=foobar%0d%0aContent-\nLength:%200%0d%0a%0d%0aHTTP/1.1%20200%20OK%0d%0aContent-\nType:%20text/html%0d%0aContent-Length:%2019%0d%0a%0d%0a<html>Shazam</html>", 347 348 "apos'trophe@thatmightbe.com", 349 "apos''''trophe@thatmightbe.com", 350 "su+s+an@thatmightbe.com", 351 "per.iod@thatmightbe.com", 352 "per..iods@thatmightbe.com", 353 ".period@thatmightbe.com", 354 "tom(comment)@thatmightbe.com", 355 "(comment)tom@thatmightbe.com", 356 "\"quotes\"@thatmightbe.com", 357 "\"\\\"(),:;<>@[\\]\"@thatmightbe.com", 358 "a!#$%&'*+-/=?^_`{|}~b@thatmightbe.com", 359 "jill@(comment)example.com", 360 "jill@example.com(comment)", 361 "ben@ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg.com", 362 "judy@gggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg.com", 363 "ggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggggg@AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.com", 364 } 365 366 // Strings that should pass as acceptable team names 367 var FuzzyStringsNames = []string{ 368 "*", 369 "?", 370 ".", 371 "}{][)(><", 372 "{}[]()<>", 373 374 "qahwah ( قهوة)", 375 "שָׁלוֹם עֲלֵיכֶם", 376 "Ramen チャーシュー chāshū", 377 "言而无信", 378 "Ṫ͌ó̍ ̍͂̓̍̍̀i̊ͯ͒", 379 "& < &qu", 380 381 "' or '1'='1' -- ", 382 "' or '1'='1' ({ ", 383 "' or '1'='1' /* ", 384 "1;DROP TABLE users", 385 386 "<b><i><u><strong><em>", 387 388 "sue@thatmightbe", 389 "sue@thatmightbe.", 390 "sue@thatmightbe.c", 391 "sue@thatmightbe.co", 392 "sue @ thatmightbe.com", 393 "apos'trophe@thatmightbe.com", 394 "apos''''trophe@thatmightbe.com", 395 "su+san@thatmightbe.com", 396 "su+s+an@thatmightbe.com", 397 "per.iod@thatmightbe.com", 398 "per..iods@thatmightbe.com", 399 ".period@thatmightbe.com", 400 "tom(comment)@thatmightbe.com", 401 "(comment)tom@thatmightbe.com", 402 "\"quotes\"@thatmightbe.com", 403 "\"\\\"(),:;<>@[\\]\"@thatmightbe.com", 404 "a!#$%&'*+-/=?^_`{|}~b@thatmightbe.com", 405 "local@[127.0.0.1]", 406 "jill@(comment)example.com", 407 "jill@example.com(comment)", 408 "a@b.中国", 409 "1@2.am", 410 "a@b.co.uk", 411 "a@b.cancerresearch", 412 413 "<a href=\"//www.google.com\">Teh Googles</a>", 414 "<img src=\"//upload.wikimedia.org/wikipelogo-v2_2x.png\" />", 415 "<b><i><u><strong><em>", 416 "& < " '", 417 418 ";alert('Well this is awkward.');", 419 "<script type='text/javascript'>alert('yay puppies');</script>", 420 421 "Ṫ͌ó̍ ̍͂̓̍̍̀i̊ͯ͒nͧ̍̓̃͋v", 422 "H҉̵̞̟̠̖̗̘Ȅ̐̐̑̒̚OMI҉̵̞̟̠", 423 } 424 425 // Strings that should pass as acceptable emails 426 var FuzzyStringsEmails = []string{ 427 "sue@thatmightbe", 428 "sue@thatmightbe.c", 429 "sue@thatmightbe.co", 430 "su+san@thatmightbe.com", 431 "1@2.am", 432 "a@b.co.uk", 433 "a@b.cancerresearch", 434 "su+s+an@thatmightbe.com", 435 "per.iod@thatmightbe.com", 436 } 437 438 // Lovely giberish for all to use 439 const GibberishText = ` 440 Thus one besides much goodness shyly far some hyena overtook since rhinoceros nodded withdrew wombat before deserved apart a alongside the far dalmatian less ouch where yet a salmon. 441 Then jeez far marginal hey aboard more as leaned much oversold that inside spoke showed much went crud close save so and and after and informally much lion commendably less conductive oh excepting conductive compassionate jeepers hey a much leopard alas woolly untruthful outside snug rashly one cunning past fabulous adjusted far woodchuck and and indecisive crud loving exotic less resolute ladybug sprang drank under following far the as hence passably stolidly jeez the inset spaciously more cozily fishily the hey alas petted one audible yikes dear preparatory darn goldfinch gosh a then as moth more guinea. 442 Timid mislaid as salamander yikes alas ouch much that goldfinch shark in before instead dear one swore vivid versus one until regardless sang panther tolerable much preparatory hardily shuddered where coquettish far sheep coarsely exaggerated preparatory because cordial awesome gradually nutria that dear mocking behind off staunchly regarding a the komodo crud shrewd well jeez iguanodon strove strived and moodily and sought and and mounted gosh aboard crud spitefully boa. 443 One as highhanded fortuitous angelfish so one woodchuck dazedly kangaroo nasty instead far parrot away the worm yet testy where caribou a cuckoo onto dear reined because less tranquil kindhearted and shuddered plankton astride monkey methodically above evasive otter this wrung and courageous iguana wayward along cowered prior a. 444 Freely since ouch octopus the heated apart on hey the some pending placed fearless jeepers hardheadedly more that less jolly bit cuddled. 445 Caterpillar laboriously far wistful spilled aside far oriole newt and immeasurably yikes revealed raptly obdurately definitely scallop titilatingly one alongside monumentally ouch much wretched the spoke a before alas insolent abortive that turned hey hare much poignantly re-laid goodness yet the dear compassionate a hey scooped sped darn warmly oh and more darn craven that overtook fell and bluebird misheard that needless less ravenously in positively far romantically some babbled that rose honey then immaturely this and jollily irresistible much rarely earthworm parrot wow. 446 Less less bluntly jeez at goodness panther opposite oh purred a pathetically mildly less cat badly much much on from obscure in gull off manatee hatchet goodness euphemistically hence or understandable after this so that thus shook hence that mindfully yellow behind far bat wayward thanks more wrote so the flapped however alas and mallard that temperately irritably yikes squirrel. 447 Some reset some therefore demonstrably considering dachshund kindhearted far wow far whispered far clung this by partook much upon fit inscrutably so affirmative diligently far grinned and manifestly hummingbird hello caudal considering when aboard much buoyantly that unfitting far attractively far during much crud baneful jeez one toneless cynically oh spurious athletic meadowlark much generously one subconsciously arguable much forthrightly hawk inoffensively. 448 Snorted tidy stiffly against one fiendishly began burst hey revealed a beside the soothingly ceremonially affirmatively cowered when fitted this static hello emoted assenting however while far that gross besides because and dear. 449 Far therefore the blushed momentously the however one a wholeheartedly and considering incessantly that neurotically wore firefly grouped impotently dear one abjectly goodness so far a honey far insolently far so greyhound between above raucously echidna more halfhearted thankful squid one. 450 Raccoon cockatoo this while but this a far among ouch and hey alas scallop black sane as yikes hello sexy far tacky and balked wrongly more near shrewdly the yet gosh much caribou ruthlessly a on far a threw well less at the one after. 451 Spoke touched barbarously before much thus therefore darn scratched oh howled the less much hello after and jeez flagrantly weirdly crud komodo fabulous the much some cow jeering much egregiously a bucolically a admirably jeepers essential when ouch and tapir this while and wolverine. 452 Cm more much in this rewrote ouch on from aside wildebeest crane saddled where much opposite endearingly hummingbird together some beside a the goodness dear ouch ouch struck the input smooched shrugged until slick as waked hawk sincere irksomely. 453 Camel the pulled this richly grimaced leopard more false thought dear militant added yikes supp infallibly set orca beat hello while accurately reliably while lorikeet one strategic less hello without and smooched across plankton but jeepers pangolin the rich seal sneered pre-set lynx on radical nasty alas onto more hence flabby outbid murkily congenially dived much lubber added far eccentrically turtle before outsold onto ouch thus much and hawk tolerable much knitted yikes shot much limpet one this woolly much however hence up angry up well. 454 Unicorn yawned hello boundless this when express jaded closed wept tranquil after came airily merry much dismounted for much extensively less interminably far one far armadillo pled dolphin alas nutria and more oh positively koala grizzly after falcon goat strict hooted next browbeat split more far far antagonistic lingering the depending pending sheared since up before jeepers distant mastodon dropped as this more some much set far infinitesimal well shark grasshopper as hey one via some fishy and immaturely remote where weasel leopard annoying correctly wherever that sniffled much mandrill on jeez adventurous much. 455 Jeepers before spitefully buoyant concentric the reset moth a darn decidedly baboon giraffe outrageously groundhog on one at more overslept gosh worm away far far less much hysteric showed on so rattlesnake the and immature yikes baneful hence wow lynx hence past scornfully groaned pounded dived this one outside dachshund scowled one prior tenable therefore before scratched much much drank hey while added rabbit shark and supp cut this ironic limpet hedgehog bound more rebuking the jeepers thorough while more far due but yikes nastily brave dangerous opened tangibly aside after acrimoniously one cackled scratched. 456 Canny salmon hatchet more far opposite much coughed excited expedient far lizard one indiscriminate yikes jeez powerlessly forcefully tiger rooster and brought far more during this sank onto after then less amorally rude unerring some alongside irrespective bat hungrily kangaroo extravagantly inside ouch much gosh dreadfully oh much darn prior as fired guinea. 457 Irksomely upon up for amicably one since contrary one until flamingo tarantula far koala despite easy well gazelle ungracefully rose less that under hey more criminal unique furrowed so disbanded normal where one a a hey circuitous ouch feverish for the kookaburra and pithy far far then more the versus cliquishly across oh and explicitly much therefore as tamely alongside underlay much yikes imminently off however far across instantaneous therefore wallaby evidently foul foretold as far a jeepers invidious bearish. 458 More and until scandalously after wallaby petted oh much as poked much caterpillar drank beside rode actively walking scooped weird this duteous that far before human during dear house thrust more flinched opposite that ahead in far. 459 The painful essential jeepers merrily proudly essential and less far dismounted inside mongoose beyond confessedly robin shined heron the during since according suggestively and less some strident combed alas much man-of-war forgave so and to then inanimately. 460 Beside far this this a crud polite cantankerous exclusively misheard pled far circuitously and frugal less more temperately gauche goldfinch oh against this along excitedly goodhearted more classically quit serenely outside vulture ouch after one a this yet. 461 Less and handsomely manatee some amidst much reined komodo busted exultingly but fatuously less across mighty goodness objective alas glaringly gregariously hello the since one pridefully much well placed far less goodness jellyfish unnecessary reciprocating a far stylistic gazed one. 462 Hey rethought excepting lamely much and naughtily amidst more since jeez then bluebird hence less bald by some brought left the across logic loyal brightly jeez capitally that less more forward rebound a yikes chose convulsively confidently repeated broadcast much dipped when awesomely or some some regal the scowled merry zebra since more credible so inescapably fetchingly and lantern that due dear one went gosh wow well furrowed much much specially spoiled as vitally instead the seriously some rooster irrespective well imprecisely rapidly more llama. 463 Up to and hey without pill that this squid alas brusque on inventoried and spread the more excepting aristocratically due piquant wove beneath that macaw in more until much grimaced far and jeez enticingly unicorn some far crab more barring purely jeepers clear groomed glaring hey dear hence before the this hello.` 464 465 func RandString(l int, charset string) string { 466 ret := make([]byte, l) 467 for i := 0; i < l; i++ { 468 ret[i] = charset[rand.Intn(len(charset))] 469 } 470 return string(ret) 471 } 472 473 // func RandomEmail(length Range, charset string) string { 474 // emaillen := RandIntFromRange(length) 475 // username := RandString(emaillen, charset) 476 // domain := "simulator.amazonses.com" 477 // return "success+" + username + "@" + domain 478 // } 479 480 // func FuzzEmail() string { 481 // return FuzzyStringsEmails[RandIntFromRange(Range{0, len(FuzzyStringsEmails) - 1})] 482 // } 483 484 func RandomName(length Range, charset string) string { 485 namelen := RandIntFromRange(length) 486 return RandString(namelen, charset) 487 } 488 489 func FuzzName() string { 490 return FuzzyStringsNames[RandIntFromRange(Range{0, len(FuzzyStringsNames) - 1})] 491 } 492 493 // Random selection of text for post 494 func RandomText(length Range, hashtags Range, mentions Range, users []string) string { 495 textLength := RandIntFromRange(length) 496 numHashtags := RandIntFromRange(hashtags) 497 numMentions := RandIntFromRange(mentions) 498 if textLength > len(GibberishText) || textLength < 0 { 499 textLength = len(GibberishText) 500 } 501 startPosition := RandIntFromRange(Range{0, len(GibberishText) - textLength - 1}) 502 503 words := strings.Split(GibberishText[startPosition:startPosition+textLength], " ") 504 for i := 0; i < numHashtags; i++ { 505 randword := RandIntFromRange(Range{0, len(words) - 1}) 506 words = append(words, " #"+words[randword]) 507 } 508 if len(users) > 0 { 509 for i := 0; i < numMentions; i++ { 510 randuser := RandIntFromRange(Range{0, len(users) - 1}) 511 words = append(words, " @"+users[randuser]) 512 } 513 } 514 515 // Shuffle the words 516 for i := range words { 517 j := rand.Intn(i + 1) 518 words[i], words[j] = words[j], words[i] 519 } 520 521 return strings.Join(words, " ") 522 } 523 524 func FuzzPost() string { 525 return FuzzyStringsPosts[RandIntFromRange(Range{0, len(FuzzyStringsPosts) - 1})] 526 }