Skip to content

Full Toolkit for Next-Level Domain Analysis

Add link to records referring to other domains 🔗

Felix Wotschofskye7ee8081b056
diff --git a/components/RecordRow.tsx b/components/RecordRow.tsx
index 44e0fae..5a41ac8 100644
--- a/components/RecordRow.tsx
+++ b/components/RecordRow.tsx
@@ -1,13 +1,49 @@
+import { ExternalLinkIcon } from '@chakra-ui/icons';
import { FaInfoCircle } from 'react-icons/fa';
-import { IconButton, Td, Tr, useDisclosure } from '@chakra-ui/react';
+import { IconButton, Td, Tooltip, Tr, useDisclosure } from '@chakra-ui/react';
+import { useRouter } from 'next/router';
+import isFQDN from 'validator/lib/isFQDN';
import isIP from 'validator/lib/isIP';
import { RawRecord } from '@/utils/DnsLookup';
import IpDetailsModal from '@/components/IpDetailsModal';
const RecordRow = ({ record }: { record: RawRecord }) => {
+ const router = useRouter();
const { isOpen, onOpen, onClose } = useDisclosure();
- const recordIsIp = isIP(record.data);
+
+ let specialAction = null;
+ if (isIP(record.data)) {
+ specialAction = (
+ <>
+ <Tooltip label="View IP Info">
+ <IconButton
+ variant="link"
+ size="sm"
+ ml={1}
+ aria-label="View IP Info"
+ icon={<FaInfoCircle />}
+ onClick={onOpen}
+ />
+ </Tooltip>
+ <IpDetailsModal ip={record.data} isOpen={isOpen} onClose={onClose} />
+ </>
+ );
+ } else if (isFQDN(record.data.slice(0, -1))) {
+ const targetDomain = record.data.slice(0, -1);
+ specialAction = (
+ <Tooltip label="View Domain Records">
+ <IconButton
+ variant="link"
+ size="sm"
+ ml={1}
+ aria-label="View Domain Records"
+ icon={<ExternalLinkIcon />}
+ onClick={() => router.push(`/lookup/${targetDomain}`)}
+ />
+ </Tooltip>
+ );
+ }
return (
<>
@@ -16,24 +52,7 @@ const RecordRow = ({ record }: { record: RawRecord }) => {
<Td>{record.TTL}</Td>
<Td>
{record.data}
-
- {recordIsIp && (
- <>
- <IconButton
- variant="link"
- size="sm"
- ml={1}
- aria-label="Get IP Info"
- icon={<FaInfoCircle size="16px" />}
- onClick={onOpen}
- />
- <IpDetailsModal
- ip={record.data}
- isOpen={isOpen}
- onClose={onClose}
- />
- </>
- )}
+ {specialAction}
</Td>
</Tr>
</>