2 ms·
#!/bin/sh # uses addcr from djb's UCSPI cat << eof|stunnel -fd 0 foreground=no [ twitter.com ] accept=127.104.2
by 1vuio0pswjnm7 4y ago
#!/bin/sh
# uses addcr from djb's UCSPI
cat << eof|stunnel -fd 0
foreground=no
[ twitter.com ]
accept=127.104.244.42:1
client=yes
connect=104.244.42.1:443
options=NO_TICKET
options=NO_RENEGOTIATION
renegotiation=no
sni=
sslVersion=TLSv1.3
eof
test $# = 1||exec echo usage: $0 user_name
__1__=$1
__w__=500
__h1__="host: twitter.com"
__h2__="connection: close"
__h3__="content-type: application/json"
__h4__="authorization: Bearer"
__h5__="x-guest-token:"
# 1. get gt= ie, x-guest-token
__x__=$(
addcr << eof|nc -vvn 127.104.244.42 1 |sed -n '/gt=/{s/.*gt=//;s/;.*//p;}';
GET /$__1__ HTTP/1.1
$__h1__
$__h2__
eof
)
echo "x-guest-token: $__x__" >&2;
public_token=AAAAAAAAAAAAAAAAAAAAANRILgAAAAAAnNwIzUejRCOuH5E6I8xnZz4puTs%3D1Zv7ttfk8LF81IUq16cHjhLTvJu4FA33AGWWjCpTnA
# 2. get userbyscreenname and rest_id
__y__=$(
addcr << eof|nc -vvn 127.104.244.42 1|sed -n '/\"rest_id\":/{s/.*\"rest_id\":\"//;s/\".*//p;}'
GET /i/api/graphql/mCbpQvZAw6zu_4PvuAUVVQ/UserByScreenName?variables=%7B%22screen_name%22%3A%22$__1__%22%2C%22withSafetyModeUserFields%22%3Atrue%2C%22withSuperFollowsUserFields%22%3Atrue%7D HTTP/1.1
$__h1__
$__h3__
$__h4__ $public_token
$__h5__ $__x__
$__h2__
eof
)
echo "\"rest_id\": $__y__" >&2;
# 3. get usertweets
addcr << eof|nc -vvn 127.104.244.42 1
GET /i/api/graphql/3ywp9kIIW-VQOssauKmLiQ/UserTweets?variables=%7B%22userId%22%3A%22$__y__%22%2C%22count%22%3A$__w__%2C%22includePromotedContent%22%3Atrue%2C%22withQuickPromoteEligibilityTweetFields%22%3Atrue%2C%22withSuperFollowsUserFields%22%3Atrue%2C%22withDownvotePerspective%22%3Afalse%2C%22withReactionsMetadata%22%3Afalse%2C%22withReactionsPerspective%22%3Afalse%2C%22withSuperFollowsTweetFields%22%3Atrue%2C%22withVoice%22%3Atrue%2C%22withV2Timeline%22%3Atrue%7D&features=%7B%22dont_mention_me_view_api_enabled%22%3Atrue%2C%22interactive_text_enabled%22%3Atrue%2C%22responsive_web_uc_gql_enabled%22%3Afalse%2C%22vibe_tweet_context_enabled%22%3Afalse%2C%22responsive_web_edit_tweet_api_enabled%22%3Afalse%2C%22standardized_nudges_misinfo%22%3Afalse%2C%22responsive_web_enhance_cards_enabled%22%3Afalse%2C%22include_rts%22%3Atrue%7D HTTP/1.1
$__h1__
$__h3__
$__h4__ $public_token
$__h5__ $__x__
$__h2__
eof
exec kill $(ss -ptnl|sed -n '/127.104.244.42:1/{s>.*,pid=>>;s>,.*>>p;}')
- 1vuio0pswjnm7 4y agoIncludes useless use of cat for good measure.