Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
Cloudcone Easter
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
Cloudcone Easter
Commits
4a1b0752
Commit
4a1b0752
authored
Apr 13, 2022
by
nanahira
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hunter
parent
68bd3eda
Pipeline
#11599
passed with stage
in 23 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
15 deletions
+27
-15
index.ts
index.ts
+27
-15
No files found.
index.ts
View file @
4a1b0752
...
...
@@ -2,48 +2,60 @@ import axios from 'axios';
import
fs
from
'
fs
'
;
import
_
from
'
lodash
'
;
let
current
=
parseInt
(
process
.
env
.
CURRENT
||
'
0
'
,
36
)
;
const
max
=
parseInt
(
process
.
env
.
MAX
||
'
ZZZZ
'
,
36
)
;
let
current
=
parseInt
(
process
.
env
.
CURRENT
)
||
0
;
const
max
=
parseInt
(
process
.
env
.
MAX
)
||
26
*
26
*
26
*
26
-
1
;
const
parallel
=
parseInt
(
process
.
env
.
PARALLEL
)
||
10
;
const
urlPrefix
=
process
.
env
.
URL_PREFIX
;
const
useCode
=
async
(
n
:
number
)
=>
{
let
code
=
n
.
toString
(
36
).
toUpperCase
();
if
(
code
.
length
<
4
)
{
code
=
'
0
'
.
repeat
(
4
-
code
.
length
)
+
code
;
function
toCode
(
n
:
number
)
{
let
code
=
''
;
for
(
let
i
=
0
;
i
<
4
;
i
++
)
{
code
=
String
.
fromCharCode
((
n
%
26
)
+
'
a
'
.
charCodeAt
(
0
))
+
code
;
n
=
Math
.
floor
(
n
/
26
);
}
console
.
log
(
`Trying
${
code
}
`
);
return
code
;
}
const
useCode
=
async
(
n
:
number
)
=>
{
const
code
=
toCode
(
n
);
console
.
log
(
`Trying
${
n
}
:
${
code
}
`
);
try
{
const
result
=
await
axios
.
get
(
`
http://www.clco.cc/
${
code
}
`
,
{
const
result
=
await
axios
.
get
(
`
${
urlPrefix
}
${
code
}
`
,
{
responseType
:
'
text
'
,
validateStatus
:
(
c
)
=>
c
<
400
||
c
===
404
,
validateStatus
:
(
c
)
=>
c
===
200
,
timeout
:
parseInt
(
process
.
env
.
TIMEOUT
)
||
10000
,
});
if
(
result
.
status
===
404
)
{
console
.
log
(
`Bad
${
code
}
`
);
if
(
!
result
.
data
?.
includes
(
'
<title>Create VPS — CLOUDCONE</title>
'
)
)
{
console
.
log
(
`Bad
${
n
}
-
${
code
}
`
);
}
else
{
const
data
=
{
status
:
result
.
status
,
headers
:
result
.
headers
,
data
:
result
.
data
,
};
console
.
log
(
`Good
${
code
}
:
${
JSON
.
stringify
(
data
)}
`
);
console
.
log
(
`Good
${
n
}
-
${
code
}
:
${
JSON
.
stringify
(
data
)}
`
);
await
fs
.
promises
.
writeFile
(
`data/
$
{
n
}
-
${
code
}
.json`
,
`data/$
${
code
}
.json`
,
JSON
.
stringify
(
data
,
null
,
2
),
);
return
true
;
}
}
catch
(
e
)
{
console
.
error
(
`Failed
${
code
}
:
${
e
.
message
}
`
);
}
return
false
;
};
async
function
main
()
{
while
(
current
<=
max
)
{
const
start
=
current
;
const
end
=
Math
.
min
(
current
+
parallel
,
max
+
1
);
console
.
log
(
`Running
${
start
}
-
${
end
-
1
}
`
);
console
.
log
(
`Running
from
${
start
}
to
${
end
-
1
}
`
);
const
ranges
=
_
.
range
(
start
,
end
);
await
Promise
.
all
(
ranges
.
map
(
useCode
));
const
results
=
await
Promise
.
all
(
ranges
.
map
(
useCode
));
if
(
results
.
some
((
result
)
=>
result
))
{
break
;
}
current
=
end
;
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment