Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
chinese-obfs
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Recolic
chinese-obfs
Commits
e5f51009
There was an error fetching the commit references. Please try again later.
Commit
e5f51009
authored
4 years ago
by
Bensong Liu
Browse files
Options
Downloads
Patches
Plain Diff
.
parent
dc5041c4
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bullshit.py
+10
-19
10 additions, 19 deletions
bullshit.py
with
10 additions
and
19 deletions
bullshit.py
+
10
−
19
View file @
e5f51009
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
# -*- coding: UTF-8 -*-
# -*- coding: UTF-8 -*-
import
os
,
re
import
os
,
re
import
rand
om
from
random
import
rand
int
import
gzip
import
gzip
def
loadJson
(
fileName
):
def
loadJson
(
fileName
):
...
@@ -22,17 +22,6 @@ print("debug: len=", [len(l) for l in [famous_data, prefix_data, postfix_data, n
...
@@ -22,17 +22,6 @@ print("debug: len=", [len(l) for l in [famous_data, prefix_data, postfix_data, n
repeat_factor
=
2
repeat_factor
=
2
def
randomized_yield
(
iterable
):
global
repeat_factor
pool
=
list
(
iterable
)
*
repeat_factor
while
True
:
random
.
shuffle
(
pool
)
for
ele
in
pool
:
yield
ele
nonsense_generator
=
randomized_yield
(
nonsense_data
)
famous_generator
=
randomized_yield
(
famous_data
)
def
new_famous
():
def
new_famous
():
global
famous_generator
global
famous_generator
famous
=
next
(
famous_generator
)
famous
=
next
(
famous_generator
)
...
@@ -50,6 +39,10 @@ def paragraph_is_valid(text):
...
@@ -50,6 +39,10 @@ def paragraph_is_valid(text):
return
False
return
False
return
True
return
True
def
slice_bits
(
data
,
offset
,
count
):
return
8
topic
=
'
testing_topic
'
topic
=
'
testing_topic
'
input_string
=
'
hello world
'
input_string
=
'
hello world
'
...
@@ -63,17 +56,15 @@ def decode(text):
...
@@ -63,17 +56,15 @@ def decode(text):
continue
continue
def
encode
(
text
,
topic
,
data
)
if
__name__
==
"
__main__
"
:
topic
=
input
(
"
请输入文章主题:
"
)
result
=
'
'
result
=
'
'
curr_paragraph
=
''
curr_paragraph
=
''
while
(
len
(
result
)
<
6000
)
:
curr_data_offset
=
0
randsrc
=
random
.
randint
(
0
,
100
)
while
curr_data_offset
<
len
(
data
)
*
8
:
if
rand
src
<
5
and
paragraph_is_valid
(
curr_paragraph
):
if
rand
int
(
0
,
100
)
<
5
and
paragraph_is_valid
(
curr_paragraph
):
result
+=
curr_paragraph
+
paragraph_tail
()
result
+=
curr_paragraph
+
paragraph_tail
()
curr_paragraph
=
''
curr_paragraph
=
''
elif
rand
src
<
20
:
elif
rand
int
(
0
,
100
)
<
20
:
curr_paragraph
+=
new_famous
()
curr_paragraph
+=
new_famous
()
else
:
else
:
curr_paragraph
+=
next
(
nonsense_generator
)
curr_paragraph
+=
next
(
nonsense_generator
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment