Skip to content

Commit a580e93

Browse files
committed
Rename offline to offline_only
1 parent e521158 commit a580e93

File tree

1 file changed

+26
-19
lines changed

1 file changed

+26
-19
lines changed

pwnlib/libcdb.py

+26-19
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def provider_local_database(hex_encoded_id, hash_type):
148148
"online": [provider_libcdb, provider_libc_rip]
149149
}
150150

151-
def search_by_hash(hex_encoded_id, hash_type='build_id', unstrip=True, offline=False):
151+
def search_by_hash(hex_encoded_id, hash_type='build_id', unstrip=True, offline_only=False):
152152
assert hash_type in HASHES, hash_type
153153

154154
# Ensure that the libcdb cache directory exists
@@ -161,7 +161,7 @@ def search_by_hash(hex_encoded_id, hash_type='build_id', unstrip=True, offline=F
161161
return None
162162

163163
providers = PROVIDERS["offline"]
164-
if not offline:
164+
if not offline_only:
165165
providers += PROVIDERS["online"]
166166

167167
# Run through all available libc database providers to see if we have a match.
@@ -610,7 +610,7 @@ def search_by_symbol_offsets(symbols, select_index=None, unstrip=True, return_as
610610
selected_libc = _handle_multiple_matching_libcs(matching_libcs)
611611
return search_by_build_id(selected_libc['buildid'], unstrip=unstrip)
612612

613-
def search_by_build_id(hex_encoded_id, unstrip=True, offline=False):
613+
def search_by_build_id(hex_encoded_id, unstrip=True, offline_only=False):
614614
"""
615615
Given a hex-encoded Build ID, attempt to download a matching libc from libcdb.
616616
@@ -619,8 +619,10 @@ def search_by_build_id(hex_encoded_id, unstrip=True, offline=False):
619619
Hex-encoded Build ID (e.g. 'ABCDEF...') of the library
620620
unstrip(bool):
621621
Try to fetch debug info for the libc and apply it to the downloaded file.
622-
offline(bool):
623-
Enable offline search mode, which will disable online providers.
622+
offline_only(bool):
623+
Both offline and online providers are used by default. When pass
624+
`offline_only=True`, libcdb enable an exclusive offline search mode,
625+
which will disable online providers.
624626
625627
Returns:
626628
Path to the downloaded library on disk, or :const:`None`.
@@ -636,9 +638,9 @@ def search_by_build_id(hex_encoded_id, unstrip=True, offline=False):
636638
>>> hex(ELF(filename).symbols.read)
637639
'0xeef40'
638640
"""
639-
return search_by_hash(hex_encoded_id, 'build_id', unstrip, offline)
641+
return search_by_hash(hex_encoded_id, 'build_id', unstrip, offline_only)
640642

641-
def search_by_md5(hex_encoded_id, unstrip=True, offline=False):
643+
def search_by_md5(hex_encoded_id, unstrip=True, offline_only=False):
642644
"""
643645
Given a hex-encoded md5sum, attempt to download a matching libc from libcdb.
644646
@@ -647,8 +649,10 @@ def search_by_md5(hex_encoded_id, unstrip=True, offline=False):
647649
Hex-encoded md5sum (e.g. 'ABCDEF...') of the library
648650
unstrip(bool):
649651
Try to fetch debug info for the libc and apply it to the downloaded file.
650-
offline(bool):
651-
Enable offline search mode, which will disable online providers.
652+
offline_only(bool):
653+
Both offline and online providers are used by default. When pass
654+
`offline_only=True`, libcdb enable an exclusive offline search mode,
655+
which will disable online providers.
652656
653657
Returns:
654658
Path to the downloaded library on disk, or :const:`None`.
@@ -664,9 +668,9 @@ def search_by_md5(hex_encoded_id, unstrip=True, offline=False):
664668
>>> hex(ELF(filename).symbols.read)
665669
'0xeef40'
666670
"""
667-
return search_by_hash(hex_encoded_id, 'md5', unstrip, offline)
671+
return search_by_hash(hex_encoded_id, 'md5', unstrip, offline_only)
668672

669-
def search_by_sha1(hex_encoded_id, unstrip=True, offline=False):
673+
def search_by_sha1(hex_encoded_id, unstrip=True, offline_only=False):
670674
"""
671675
Given a hex-encoded sha1, attempt to download a matching libc from libcdb.
672676
@@ -675,8 +679,10 @@ def search_by_sha1(hex_encoded_id, unstrip=True, offline=False):
675679
Hex-encoded sha1sum (e.g. 'ABCDEF...') of the library
676680
unstrip(bool):
677681
Try to fetch debug info for the libc and apply it to the downloaded file.
678-
offline(bool):
679-
Enable offline search mode, which will disable online providers.
682+
offline_only(bool):
683+
Both offline and online providers are used by default. When pass
684+
`offline_only=True`, libcdb enable an exclusive offline search mode,
685+
which will disable online providers.
680686
681687
Returns:
682688
Path to the downloaded library on disk, or :const:`None`.
@@ -692,10 +698,9 @@ def search_by_sha1(hex_encoded_id, unstrip=True, offline=False):
692698
>>> hex(ELF(filename).symbols.read)
693699
'0xeef40'
694700
"""
695-
return search_by_hash(hex_encoded_id, 'sha1', unstrip, offline)
701+
return search_by_hash(hex_encoded_id, 'sha1', unstrip, offline_only)
696702

697-
698-
def search_by_sha256(hex_encoded_id, unstrip=True, offline=False):
703+
def search_by_sha256(hex_encoded_id, unstrip=True, offline_only=False):
699704
"""
700705
Given a hex-encoded sha256, attempt to download a matching libc from libcdb.
701706
@@ -704,8 +709,10 @@ def search_by_sha256(hex_encoded_id, unstrip=True, offline=False):
704709
Hex-encoded sha256sum (e.g. 'ABCDEF...') of the library
705710
unstrip(bool):
706711
Try to fetch debug info for the libc and apply it to the downloaded file.
707-
offline(bool):
708-
Enable offline search mode, which will disable online providers.
712+
offline_only(bool):
713+
Both offline and online providers are used by default. When pass
714+
`offline_only=True`, libcdb enable an exclusive offline search mode,
715+
which will disable online providers.
709716
710717
Returns:
711718
Path to the downloaded library on disk, or :const:`None`.
@@ -721,7 +728,7 @@ def search_by_sha256(hex_encoded_id, unstrip=True, offline=False):
721728
>>> hex(ELF(filename).symbols.read)
722729
'0xeef40'
723730
"""
724-
return search_by_hash(hex_encoded_id, 'sha256', unstrip, offline)
731+
return search_by_hash(hex_encoded_id, 'sha256', unstrip, offline_only)
725732

726733

727734

0 commit comments

Comments
 (0)